diff options
| -rw-r--r-- | color.py | 18 | ||||
| -rw-r--r-- | project.py | 19 | ||||
| -rw-r--r-- | subcmds/info.py | 2 | ||||
| -rw-r--r-- | subcmds/sync.py | 12 |
4 files changed, 43 insertions, 8 deletions
| @@ -126,6 +126,13 @@ class Coloring(object): | |||
| 126 | s._out.write(c(fmt, *args)) | 126 | s._out.write(c(fmt, *args)) |
| 127 | return f | 127 | return f |
| 128 | 128 | ||
| 129 | def nofmt_printer(self, opt=None, fg=None, bg=None, attr=None): | ||
| 130 | s = self | ||
| 131 | c = self.nofmt_colorer(opt, fg, bg, attr) | ||
| 132 | def f(fmt): | ||
| 133 | s._out.write(c(fmt)) | ||
| 134 | return f | ||
| 135 | |||
| 129 | def colorer(self, opt=None, fg=None, bg=None, attr=None): | 136 | def colorer(self, opt=None, fg=None, bg=None, attr=None): |
| 130 | if self._on: | 137 | if self._on: |
| 131 | c = self._parse(opt, fg, bg, attr) | 138 | c = self._parse(opt, fg, bg, attr) |
| @@ -138,6 +145,17 @@ class Coloring(object): | |||
| 138 | return fmt % args | 145 | return fmt % args |
| 139 | return f | 146 | return f |
| 140 | 147 | ||
| 148 | def nofmt_colorer(self, opt=None, fg=None, bg=None, attr=None): | ||
| 149 | if self._on: | ||
| 150 | c = self._parse(opt, fg, bg, attr) | ||
| 151 | def f(fmt): | ||
| 152 | return ''.join([c, fmt, RESET]) | ||
| 153 | return f | ||
| 154 | else: | ||
| 155 | def f(fmt): | ||
| 156 | return fmt | ||
| 157 | return f | ||
| 158 | |||
| 141 | def _parse(self, opt, fg, bg, attr): | 159 | def _parse(self, opt, fg, bg, attr): |
| 142 | if not opt: | 160 | if not opt: |
| 143 | return _Color(fg, bg, attr) | 161 | return _Color(fg, bg, attr) |
| @@ -946,6 +946,11 @@ class Project(object): | |||
| 946 | dest_branch) | 946 | dest_branch) |
| 947 | if auto_topic: | 947 | if auto_topic: |
| 948 | ref_spec = ref_spec + '/' + branch.name | 948 | ref_spec = ref_spec + '/' + branch.name |
| 949 | if not url.startswith('ssh://'): | ||
| 950 | rp = ['r=%s' % p for p in people[0]] + \ | ||
| 951 | ['cc=%s' % p for p in people[1]] | ||
| 952 | if rp: | ||
| 953 | ref_spec = ref_spec + '%' + ','.join(rp) | ||
| 949 | cmd.append(ref_spec) | 954 | cmd.append(ref_spec) |
| 950 | 955 | ||
| 951 | if GitCommand(self, cmd, bare = True).Wait() != 0: | 956 | if GitCommand(self, cmd, bare = True).Wait() != 0: |
| @@ -963,7 +968,8 @@ class Project(object): | |||
| 963 | quiet=False, | 968 | quiet=False, |
| 964 | is_new=None, | 969 | is_new=None, |
| 965 | current_branch_only=False, | 970 | current_branch_only=False, |
| 966 | clone_bundle=True): | 971 | clone_bundle=True, |
| 972 | no_tags=False): | ||
| 967 | """Perform only the network IO portion of the sync process. | 973 | """Perform only the network IO portion of the sync process. |
| 968 | Local working directory/branch state is not affected. | 974 | Local working directory/branch state is not affected. |
| 969 | """ | 975 | """ |
| @@ -1001,7 +1007,8 @@ class Project(object): | |||
| 1001 | current_branch_only = True | 1007 | current_branch_only = True |
| 1002 | 1008 | ||
| 1003 | if not self._RemoteFetch(initial=is_new, quiet=quiet, alt_dir=alt_dir, | 1009 | if not self._RemoteFetch(initial=is_new, quiet=quiet, alt_dir=alt_dir, |
| 1004 | current_branch_only=current_branch_only): | 1010 | current_branch_only=current_branch_only, |
| 1011 | no_tags=no_tags): | ||
| 1005 | return False | 1012 | return False |
| 1006 | 1013 | ||
| 1007 | if self.worktree: | 1014 | if self.worktree: |
| @@ -1551,7 +1558,8 @@ class Project(object): | |||
| 1551 | current_branch_only=False, | 1558 | current_branch_only=False, |
| 1552 | initial=False, | 1559 | initial=False, |
| 1553 | quiet=False, | 1560 | quiet=False, |
| 1554 | alt_dir=None): | 1561 | alt_dir=None, |
| 1562 | no_tags=False): | ||
| 1555 | 1563 | ||
| 1556 | is_sha1 = False | 1564 | is_sha1 = False |
| 1557 | tag_name = None | 1565 | tag_name = None |
| @@ -1644,7 +1652,10 @@ class Project(object): | |||
| 1644 | 1652 | ||
| 1645 | if not current_branch_only: | 1653 | if not current_branch_only: |
| 1646 | # Fetch whole repo | 1654 | # Fetch whole repo |
| 1647 | cmd.append('--tags') | 1655 | if no_tags: |
| 1656 | cmd.append('--no-tags') | ||
| 1657 | else: | ||
| 1658 | cmd.append('--tags') | ||
| 1648 | cmd.append((u'+refs/heads/*:') + remote.ToLocal('refs/heads/*')) | 1659 | cmd.append((u'+refs/heads/*:') + remote.ToLocal('refs/heads/*')) |
| 1649 | elif tag_name is not None: | 1660 | elif tag_name is not None: |
| 1650 | cmd.append('tag') | 1661 | cmd.append('tag') |
diff --git a/subcmds/info.py b/subcmds/info.py index a6eba889..8fb363f3 100644 --- a/subcmds/info.py +++ b/subcmds/info.py | |||
| @@ -48,7 +48,7 @@ class Info(PagedCommand): | |||
| 48 | self.headtext = self.out.printer('headtext', fg = 'yellow') | 48 | self.headtext = self.out.printer('headtext', fg = 'yellow') |
| 49 | self.redtext = self.out.printer('redtext', fg = 'red') | 49 | self.redtext = self.out.printer('redtext', fg = 'red') |
| 50 | self.sha = self.out.printer("sha", fg = 'yellow') | 50 | self.sha = self.out.printer("sha", fg = 'yellow') |
| 51 | self.text = self.out.printer('text') | 51 | self.text = self.out.nofmt_printer('text') |
| 52 | self.dimtext = self.out.printer('dimtext', attr = 'dim') | 52 | self.dimtext = self.out.printer('dimtext', attr = 'dim') |
| 53 | 53 | ||
| 54 | self.opt = opt | 54 | self.opt = opt |
diff --git a/subcmds/sync.py b/subcmds/sync.py index 228a279a..5c369a74 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
| @@ -189,6 +189,9 @@ later is required to fix a server side protocol bug. | |||
| 189 | p.add_option('--fetch-submodules', | 189 | p.add_option('--fetch-submodules', |
| 190 | dest='fetch_submodules', action='store_true', | 190 | dest='fetch_submodules', action='store_true', |
| 191 | help='fetch submodules from server') | 191 | help='fetch submodules from server') |
| 192 | p.add_option('--no-tags', | ||
| 193 | dest='no_tags', action='store_true', | ||
| 194 | help="don't fetch tags") | ||
| 192 | if show_smart: | 195 | if show_smart: |
| 193 | p.add_option('-s', '--smart-sync', | 196 | p.add_option('-s', '--smart-sync', |
| 194 | dest='smart_sync', action='store_true', | 197 | dest='smart_sync', action='store_true', |
| @@ -235,7 +238,8 @@ later is required to fix a server side protocol bug. | |||
| 235 | success = project.Sync_NetworkHalf( | 238 | success = project.Sync_NetworkHalf( |
| 236 | quiet=opt.quiet, | 239 | quiet=opt.quiet, |
| 237 | current_branch_only=opt.current_branch_only, | 240 | current_branch_only=opt.current_branch_only, |
| 238 | clone_bundle=not opt.no_clone_bundle) | 241 | clone_bundle=not opt.no_clone_bundle, |
| 242 | no_tags=opt.no_tags) | ||
| 239 | self._fetch_times.Set(project, time.time() - start) | 243 | self._fetch_times.Set(project, time.time() - start) |
| 240 | 244 | ||
| 241 | # Lock around all the rest of the code, since printing, updating a set | 245 | # Lock around all the rest of the code, since printing, updating a set |
| @@ -273,7 +277,8 @@ later is required to fix a server side protocol bug. | |||
| 273 | if project.Sync_NetworkHalf( | 277 | if project.Sync_NetworkHalf( |
| 274 | quiet=opt.quiet, | 278 | quiet=opt.quiet, |
| 275 | current_branch_only=opt.current_branch_only, | 279 | current_branch_only=opt.current_branch_only, |
| 276 | clone_bundle=not opt.no_clone_bundle): | 280 | clone_bundle=not opt.no_clone_bundle, |
| 281 | no_tags=opt.no_tags): | ||
| 277 | fetched.add(project.gitdir) | 282 | fetched.add(project.gitdir) |
| 278 | else: | 283 | else: |
| 279 | print('error: Cannot fetch %s' % project.name, file=sys.stderr) | 284 | print('error: Cannot fetch %s' % project.name, file=sys.stderr) |
| @@ -558,7 +563,8 @@ later is required to fix a server side protocol bug. | |||
| 558 | 563 | ||
| 559 | if not opt.local_only: | 564 | if not opt.local_only: |
| 560 | mp.Sync_NetworkHalf(quiet=opt.quiet, | 565 | mp.Sync_NetworkHalf(quiet=opt.quiet, |
| 561 | current_branch_only=opt.current_branch_only) | 566 | current_branch_only=opt.current_branch_only, |
| 567 | no_tags=opt.no_tags) | ||
| 562 | 568 | ||
| 563 | if mp.HasChanges: | 569 | if mp.HasChanges: |
| 564 | syncbuf = SyncBuffer(mp.config) | 570 | syncbuf = SyncBuffer(mp.config) |
