summaryrefslogtreecommitdiffstats
path: root/project.py
diff options
context:
space:
mode:
Diffstat (limited to 'project.py')
-rw-r--r--project.py25
1 files changed, 19 insertions, 6 deletions
diff --git a/project.py b/project.py
index e8de4842..e700d16a 100644
--- a/project.py
+++ b/project.py
@@ -177,11 +177,15 @@ class ReviewableBranch(object):
177 def UploadForReview(self, people, 177 def UploadForReview(self, people,
178 auto_topic=False, 178 auto_topic=False,
179 draft=False, 179 draft=False,
180 private=False,
181 wip=False,
180 dest_branch=None): 182 dest_branch=None):
181 self.project.UploadForReview(self.name, 183 self.project.UploadForReview(self.name,
182 people, 184 people,
183 auto_topic=auto_topic, 185 auto_topic=auto_topic,
184 draft=draft, 186 draft=draft,
187 private=private,
188 wip=wip,
185 dest_branch=dest_branch) 189 dest_branch=dest_branch)
186 190
187 def GetPublishedRefs(self): 191 def GetPublishedRefs(self):
@@ -1108,6 +1112,8 @@ class Project(object):
1108 people=([], []), 1112 people=([], []),
1109 auto_topic=False, 1113 auto_topic=False,
1110 draft=False, 1114 draft=False,
1115 private=False,
1116 wip=False,
1111 dest_branch=None): 1117 dest_branch=None):
1112 """Uploads the named branch for code review. 1118 """Uploads the named branch for code review.
1113 """ 1119 """
@@ -1159,9 +1165,14 @@ class Project(object):
1159 dest_branch) 1165 dest_branch)
1160 if auto_topic: 1166 if auto_topic:
1161 ref_spec = ref_spec + '/' + branch.name 1167 ref_spec = ref_spec + '/' + branch.name
1168
1162 if not url.startswith('ssh://'): 1169 if not url.startswith('ssh://'):
1163 rp = ['r=%s' % p for p in people[0]] + \ 1170 rp = ['r=%s' % p for p in people[0]] + \
1164 ['cc=%s' % p for p in people[1]] 1171 ['cc=%s' % p for p in people[1]]
1172 if private:
1173 rp = rp + ['private']
1174 if wip:
1175 rp = rp + ['wip']
1165 if rp: 1176 if rp:
1166 ref_spec = ref_spec + '%' + ','.join(rp) 1177 ref_spec = ref_spec + '%' + ','.join(rp)
1167 cmd.append(ref_spec) 1178 cmd.append(ref_spec)
@@ -1275,7 +1286,7 @@ class Project(object):
1275 1286
1276 need_to_fetch = not (optimized_fetch and 1287 need_to_fetch = not (optimized_fetch and
1277 (ID_RE.match(self.revisionExpr) and 1288 (ID_RE.match(self.revisionExpr) and
1278 self._CheckForSha1())) 1289 self._CheckForImmutableRevision()))
1279 if (need_to_fetch and 1290 if (need_to_fetch and
1280 not self._RemoteFetch(initial=is_new, quiet=quiet, alt_dir=alt_dir, 1291 not self._RemoteFetch(initial=is_new, quiet=quiet, alt_dir=alt_dir,
1281 current_branch_only=current_branch_only, 1292 current_branch_only=current_branch_only,
@@ -1885,7 +1896,7 @@ class Project(object):
1885 1896
1886 1897
1887# Direct Git Commands ## 1898# Direct Git Commands ##
1888 def _CheckForSha1(self): 1899 def _CheckForImmutableRevision(self):
1889 try: 1900 try:
1890 # if revision (sha or tag) is not present then following function 1901 # if revision (sha or tag) is not present then following function
1891 # throws an error. 1902 # throws an error.
@@ -1939,7 +1950,9 @@ class Project(object):
1939 tag_name = self.revisionExpr[len(R_TAGS):] 1950 tag_name = self.revisionExpr[len(R_TAGS):]
1940 1951
1941 if is_sha1 or tag_name is not None: 1952 if is_sha1 or tag_name is not None:
1942 if self._CheckForSha1(): 1953 if self._CheckForImmutableRevision():
1954 print('Skipped fetching project %s (already have persistent ref)'
1955 % self.name)
1943 return True 1956 return True
1944 if is_sha1 and not depth: 1957 if is_sha1 and not depth:
1945 # When syncing a specific commit and --depth is not set: 1958 # When syncing a specific commit and --depth is not set:
@@ -2095,7 +2108,7 @@ class Project(object):
2095 # We just synced the upstream given branch; verify we 2108 # We just synced the upstream given branch; verify we
2096 # got what we wanted, else trigger a second run of all 2109 # got what we wanted, else trigger a second run of all
2097 # refs. 2110 # refs.
2098 if not self._CheckForSha1(): 2111 if not self._CheckForImmutableRevision():
2099 if current_branch_only and depth: 2112 if current_branch_only and depth:
2100 # Sync the current branch only with depth set to None 2113 # Sync the current branch only with depth set to None
2101 return self._RemoteFetch(name=name, 2114 return self._RemoteFetch(name=name,
@@ -2961,14 +2974,14 @@ class MetaProject(Project):
2961 self.revisionExpr = base 2974 self.revisionExpr = base
2962 self.revisionId = None 2975 self.revisionId = None
2963 2976
2964 def MetaBranchSwitch(self): 2977 def MetaBranchSwitch(self, submodules=False):
2965 """ Prepare MetaProject for manifest branch switch 2978 """ Prepare MetaProject for manifest branch switch
2966 """ 2979 """
2967 2980
2968 # detach and delete manifest branch, allowing a new 2981 # detach and delete manifest branch, allowing a new
2969 # branch to take over 2982 # branch to take over
2970 syncbuf = SyncBuffer(self.config, detach_head=True) 2983 syncbuf = SyncBuffer(self.config, detach_head=True)
2971 self.Sync_LocalHalf(syncbuf) 2984 self.Sync_LocalHalf(syncbuf, submodules=submodules)
2972 syncbuf.Finish() 2985 syncbuf.Finish()
2973 2986
2974 return GitCommand(self, 2987 return GitCommand(self,