diff options
-rw-r--r-- | command.py | 5 | ||||
-rw-r--r-- | manifest_xml.py | 6 | ||||
-rw-r--r-- | project.py | 20 | ||||
-rw-r--r-- | subcmds/forall.py | 5 | ||||
-rw-r--r-- | subcmds/list.py | 5 | ||||
-rw-r--r-- | subcmds/sync.py | 4 |
6 files changed, 29 insertions, 16 deletions
@@ -126,7 +126,7 @@ class Command(object): | |||
126 | pass | 126 | pass |
127 | return project | 127 | return project |
128 | 128 | ||
129 | def GetProjects(self, args, missing_ok=False, submodules_ok=False): | 129 | def GetProjects(self, args, groups='', missing_ok=False, submodules_ok=False): |
130 | """A list of projects that match the arguments. | 130 | """A list of projects that match the arguments. |
131 | """ | 131 | """ |
132 | all_projects_list = self.manifest.projects | 132 | all_projects_list = self.manifest.projects |
@@ -134,7 +134,8 @@ class Command(object): | |||
134 | 134 | ||
135 | mp = self.manifest.manifestProject | 135 | mp = self.manifest.manifestProject |
136 | 136 | ||
137 | groups = mp.config.GetString('manifest.groups') | 137 | if not groups: |
138 | groups = mp.config.GetString('manifest.groups') | ||
138 | if not groups: | 139 | if not groups: |
139 | groups = 'default,platform-' + platform.system().lower() | 140 | groups = 'default,platform-' + platform.system().lower() |
140 | groups = [x for x in re.split(r'[,\s]+', groups) if x] | 141 | groups = [x for x in re.split(r'[,\s]+', groups) if x] |
diff --git a/manifest_xml.py b/manifest_xml.py index 130e17c2..7e719600 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
@@ -202,6 +202,9 @@ class XmlManifest(object): | |||
202 | if d.revisionExpr: | 202 | if d.revisionExpr: |
203 | have_default = True | 203 | have_default = True |
204 | e.setAttribute('revision', d.revisionExpr) | 204 | e.setAttribute('revision', d.revisionExpr) |
205 | if d.destBranchExpr: | ||
206 | have_default = True | ||
207 | e.setAttribute('dest-branch', d.destBranchExpr) | ||
205 | if d.sync_j > 1: | 208 | if d.sync_j > 1: |
206 | have_default = True | 209 | have_default = True |
207 | e.setAttribute('sync-j', '%d' % d.sync_j) | 210 | e.setAttribute('sync-j', '%d' % d.sync_j) |
@@ -267,6 +270,9 @@ class XmlManifest(object): | |||
267 | if p.upstream and p.upstream != p.revisionExpr: | 270 | if p.upstream and p.upstream != p.revisionExpr: |
268 | e.setAttribute('upstream', p.upstream) | 271 | e.setAttribute('upstream', p.upstream) |
269 | 272 | ||
273 | if p.dest_branch and p.dest_branch != d.destBranchExpr: | ||
274 | e.setAttribute('dest-branch', p.dest_branch) | ||
275 | |||
270 | for c in p.copyfiles: | 276 | for c in p.copyfiles: |
271 | ce = doc.createElement('copyfile') | 277 | ce = doc.createElement('copyfile') |
272 | ce.setAttribute('src', c.src) | 278 | ce.setAttribute('src', c.src) |
@@ -1877,6 +1877,13 @@ class Project(object): | |||
1877 | 1877 | ||
1878 | if depth: | 1878 | if depth: |
1879 | cmd.append('--depth=%s' % depth) | 1879 | cmd.append('--depth=%s' % depth) |
1880 | else: | ||
1881 | # If this repo has shallow objects, then we don't know which refs have | ||
1882 | # shallow objects or not. Tell git to unshallow all fetched refs. Don't | ||
1883 | # do this with projects that don't have shallow objects, since it is less | ||
1884 | # efficient. | ||
1885 | if os.path.exists(os.path.join(self.gitdir, 'shallow')): | ||
1886 | cmd.append('--depth=2147483647') | ||
1880 | 1887 | ||
1881 | if quiet: | 1888 | if quiet: |
1882 | cmd.append('--quiet') | 1889 | cmd.append('--quiet') |
@@ -1914,16 +1921,6 @@ class Project(object): | |||
1914 | spec.append(str((u'+%s:' % branch) + remote.ToLocal(branch))) | 1921 | spec.append(str((u'+%s:' % branch) + remote.ToLocal(branch))) |
1915 | cmd.extend(spec) | 1922 | cmd.extend(spec) |
1916 | 1923 | ||
1917 | shallowfetch = self.config.GetString('repo.shallowfetch') | ||
1918 | if shallowfetch and shallowfetch != ' '.join(spec): | ||
1919 | GitCommand(self, ['fetch', '--depth=2147483647', name] | ||
1920 | + shallowfetch.split(), | ||
1921 | bare=True, ssh_proxy=ssh_proxy).Wait() | ||
1922 | if depth: | ||
1923 | self.config.SetString('repo.shallowfetch', ' '.join(spec)) | ||
1924 | else: | ||
1925 | self.config.SetString('repo.shallowfetch', None) | ||
1926 | |||
1927 | ok = False | 1924 | ok = False |
1928 | for _i in range(2): | 1925 | for _i in range(2): |
1929 | gitcmd = GitCommand(self, cmd, bare=True, ssh_proxy=ssh_proxy) | 1926 | gitcmd = GitCommand(self, cmd, bare=True, ssh_proxy=ssh_proxy) |
@@ -2347,10 +2344,11 @@ class Project(object): | |||
2347 | if copy_all: | 2344 | if copy_all: |
2348 | to_copy = os.listdir(gitdir) | 2345 | to_copy = os.listdir(gitdir) |
2349 | 2346 | ||
2347 | dotgit = os.path.realpath(dotgit) | ||
2350 | for name in set(to_copy).union(to_symlink): | 2348 | for name in set(to_copy).union(to_symlink): |
2351 | try: | 2349 | try: |
2352 | src = os.path.realpath(os.path.join(gitdir, name)) | 2350 | src = os.path.realpath(os.path.join(gitdir, name)) |
2353 | dst = os.path.realpath(os.path.join(dotgit, name)) | 2351 | dst = os.path.join(dotgit, name) |
2354 | 2352 | ||
2355 | if os.path.lexists(dst): | 2353 | if os.path.lexists(dst): |
2356 | continue | 2354 | continue |
diff --git a/subcmds/forall.py b/subcmds/forall.py index b93cd6d0..96dc99d1 100644 --- a/subcmds/forall.py +++ b/subcmds/forall.py | |||
@@ -120,6 +120,9 @@ without iterating through the remaining projects. | |||
120 | p.add_option('-r', '--regex', | 120 | p.add_option('-r', '--regex', |
121 | dest='regex', action='store_true', | 121 | dest='regex', action='store_true', |
122 | help="Execute the command only on projects matching regex or wildcard expression") | 122 | help="Execute the command only on projects matching regex or wildcard expression") |
123 | p.add_option('-g', '--groups', | ||
124 | dest='groups', | ||
125 | help="Execute the command only on projects matching the specified groups") | ||
123 | p.add_option('-c', '--command', | 126 | p.add_option('-c', '--command', |
124 | help='Command (and arguments) to execute', | 127 | help='Command (and arguments) to execute', |
125 | dest='command', | 128 | dest='command', |
@@ -213,7 +216,7 @@ without iterating through the remaining projects. | |||
213 | self.manifest.Override(smart_sync_manifest_path) | 216 | self.manifest.Override(smart_sync_manifest_path) |
214 | 217 | ||
215 | if not opt.regex: | 218 | if not opt.regex: |
216 | projects = self.GetProjects(args) | 219 | projects = self.GetProjects(args, groups=opt.groups) |
217 | else: | 220 | else: |
218 | projects = self.FindProjects(args) | 221 | projects = self.FindProjects(args) |
219 | 222 | ||
diff --git a/subcmds/list.py b/subcmds/list.py index 945c28d8..ca51c5f7 100644 --- a/subcmds/list.py +++ b/subcmds/list.py | |||
@@ -35,6 +35,9 @@ This is similar to running: repo forall -c 'echo "$REPO_PATH : $REPO_PROJECT"'. | |||
35 | p.add_option('-r', '--regex', | 35 | p.add_option('-r', '--regex', |
36 | dest='regex', action='store_true', | 36 | dest='regex', action='store_true', |
37 | help="Filter the project list based on regex or wildcard matching of strings") | 37 | help="Filter the project list based on regex or wildcard matching of strings") |
38 | p.add_option('-g', '--groups', | ||
39 | dest='groups', | ||
40 | help="Filter the project list based on the groups the project is in") | ||
38 | p.add_option('-f', '--fullpath', | 41 | p.add_option('-f', '--fullpath', |
39 | dest='fullpath', action='store_true', | 42 | dest='fullpath', action='store_true', |
40 | help="Display the full work tree path instead of the relative path") | 43 | help="Display the full work tree path instead of the relative path") |
@@ -62,7 +65,7 @@ This is similar to running: repo forall -c 'echo "$REPO_PATH : $REPO_PROJECT"'. | |||
62 | sys.exit(1) | 65 | sys.exit(1) |
63 | 66 | ||
64 | if not opt.regex: | 67 | if not opt.regex: |
65 | projects = self.GetProjects(args) | 68 | projects = self.GetProjects(args, groups=opt.groups) |
66 | else: | 69 | else: |
67 | projects = self.FindProjects(args) | 70 | projects = self.FindProjects(args) |
68 | 71 | ||
diff --git a/subcmds/sync.py b/subcmds/sync.py index a8074a40..43d450be 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -314,7 +314,9 @@ later is required to fix a server side protocol bug. | |||
314 | pm.update() | 314 | pm.update() |
315 | except _FetchError: | 315 | except _FetchError: |
316 | err_event.set() | 316 | err_event.set() |
317 | except: | 317 | except Exception as e: |
318 | print('error: Cannot fetch %s (%s: %s)' \ | ||
319 | % (project.name, type(e).__name__, str(e)), file=sys.stderr) | ||
318 | err_event.set() | 320 | err_event.set() |
319 | raise | 321 | raise |
320 | finally: | 322 | finally: |