Mercurial > hg > mercurial-crew-with-dirclash
comparison hgext/mq.py @ 3215:53e843840349
Whitespace/Tab cleanup
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Sun, 01 Oct 2006 19:26:33 +0200 |
parents | 245bb70d7dfb |
children | 1d3aceae87c1 |
comparison
equal
deleted
inserted
replaced
3214:a5603ad915c5 | 3215:53e843840349 |
---|---|
128 return (_('guard %r starts with invalid character: %r') % | 128 return (_('guard %r starts with invalid character: %r') % |
129 (guard, c)) | 129 (guard, c)) |
130 for c in bad_chars: | 130 for c in bad_chars: |
131 if c in guard: | 131 if c in guard: |
132 return _('invalid character in guard %r: %r') % (guard, c) | 132 return _('invalid character in guard %r: %r') % (guard, c) |
133 | 133 |
134 def set_active(self, guards): | 134 def set_active(self, guards): |
135 for guard in guards: | 135 for guard in guards: |
136 bad = self.check_guard(guard) | 136 bad = self.check_guard(guard) |
137 if bad: | 137 if bad: |
138 raise util.Abort(bad) | 138 raise util.Abort(bad) |
170 raise util.Abort(bad) | 170 raise util.Abort(bad) |
171 drop = self.guard_re.sub('', self.full_series[idx]) | 171 drop = self.guard_re.sub('', self.full_series[idx]) |
172 self.full_series[idx] = drop + ''.join([' #' + g for g in guards]) | 172 self.full_series[idx] = drop + ''.join([' #' + g for g in guards]) |
173 self.parse_series() | 173 self.parse_series() |
174 self.series_dirty = True | 174 self.series_dirty = True |
175 | 175 |
176 def pushable(self, idx): | 176 def pushable(self, idx): |
177 if isinstance(idx, str): | 177 if isinstance(idx, str): |
178 idx = self.series.index(idx) | 178 idx = self.series.index(idx) |
179 patchguards = self.series_guards[idx] | 179 patchguards = self.series_guards[idx] |
180 if not patchguards: | 180 if not patchguards: |
722 a = self.applied[i] | 722 a = self.applied[i] |
723 if a.name == patch: | 723 if a.name == patch: |
724 return (i, a.rev, a.name) | 724 return (i, a.rev, a.name) |
725 return None | 725 return None |
726 | 726 |
727 # if the exact patch name does not exist, we try a few | 727 # if the exact patch name does not exist, we try a few |
728 # variations. If strict is passed, we try only #1 | 728 # variations. If strict is passed, we try only #1 |
729 # | 729 # |
730 # 1) a number to indicate an offset in the series file | 730 # 1) a number to indicate an offset in the series file |
731 # 2) a unique substring of the patch name was given | 731 # 2) a unique substring of the patch name was given |
732 # 3) patchname[-+]num to indicate an offset in the series file | 732 # 3) patchname[-+]num to indicate an offset in the series file |
1636 To set a negative guard "-foo" on topmost patch ("--" is needed so | 1636 To set a negative guard "-foo" on topmost patch ("--" is needed so |
1637 hg will not interpret "-foo" as an option): | 1637 hg will not interpret "-foo" as an option): |
1638 hg qguard -- -foo | 1638 hg qguard -- -foo |
1639 | 1639 |
1640 To set guards on another patch: | 1640 To set guards on another patch: |
1641 hg qguard other.patch +2.6.17 -stable | 1641 hg qguard other.patch +2.6.17 -stable |
1642 ''' | 1642 ''' |
1643 def status(idx): | 1643 def status(idx): |
1644 guards = q.series_guards[idx] or ['unguarded'] | 1644 guards = q.series_guards[idx] or ['unguarded'] |
1645 ui.write('%s: %s\n' % (q.series[idx], ' '.join(guards))) | 1645 ui.write('%s: %s\n' % (q.series[idx], ' '.join(guards))) |
1646 q = repo.mq | 1646 q = repo.mq |
1763 if os.path.isdir(absdest): | 1763 if os.path.isdir(absdest): |
1764 name = os.path.join(name, os.path.basename(patch)) | 1764 name = os.path.join(name, os.path.basename(patch)) |
1765 absdest = q.join(name) | 1765 absdest = q.join(name) |
1766 if os.path.exists(absdest): | 1766 if os.path.exists(absdest): |
1767 raise util.Abort(_('%s already exists') % absdest) | 1767 raise util.Abort(_('%s already exists') % absdest) |
1768 | 1768 |
1769 if name in q.series: | 1769 if name in q.series: |
1770 raise util.Abort(_('A patch named %s already exists in the series file') % name) | 1770 raise util.Abort(_('A patch named %s already exists in the series file') % name) |
1771 | 1771 |
1772 if ui.verbose: | 1772 if ui.verbose: |
1773 ui.write('Renaming %s to %s\n' % (patch, name)) | 1773 ui.write('Renaming %s to %s\n' % (patch, name)) |
1860 it has a negative match) but push bar.patch (because it | 1860 it has a negative match) but push bar.patch (because it |
1861 has a positive match). | 1861 has a positive match). |
1862 | 1862 |
1863 With no arguments, prints the currently active guards. | 1863 With no arguments, prints the currently active guards. |
1864 With one argument, sets the active guard. | 1864 With one argument, sets the active guard. |
1865 | 1865 |
1866 Use -n/--none to deactivate guards (no other arguments needed). | 1866 Use -n/--none to deactivate guards (no other arguments needed). |
1867 When no guards are active, patches with positive guards are skipped | 1867 When no guards are active, patches with positive guards are skipped |
1868 and patches with negative guards are pushed. | 1868 and patches with negative guards are pushed. |
1869 | 1869 |
1870 qselect can change the guards on applied patches. It does not pop | 1870 qselect can change the guards on applied patches. It does not pop |
1950 def abort_if_wdir_patched(self, errmsg, force=False): | 1950 def abort_if_wdir_patched(self, errmsg, force=False): |
1951 if self.mq.applied and not force: | 1951 if self.mq.applied and not force: |
1952 parent = revlog.hex(self.dirstate.parents()[0]) | 1952 parent = revlog.hex(self.dirstate.parents()[0]) |
1953 if parent in [s.rev for s in self.mq.applied]: | 1953 if parent in [s.rev for s in self.mq.applied]: |
1954 raise util.Abort(errmsg) | 1954 raise util.Abort(errmsg) |
1955 | 1955 |
1956 def commit(self, *args, **opts): | 1956 def commit(self, *args, **opts): |
1957 if len(args) >= 6: | 1957 if len(args) >= 6: |
1958 force = args[5] | 1958 force = args[5] |
1959 else: | 1959 else: |
1960 force = opts.get('force') | 1960 force = opts.get('force') |
1966 | 1966 |
1967 def push(self, remote, force=False, revs=None): | 1967 def push(self, remote, force=False, revs=None): |
1968 if self.mq.applied and not force: | 1968 if self.mq.applied and not force: |
1969 raise util.Abort(_('source has mq patches applied')) | 1969 raise util.Abort(_('source has mq patches applied')) |
1970 return super(mqrepo, self).push(remote, force, revs) | 1970 return super(mqrepo, self).push(remote, force, revs) |
1971 | 1971 |
1972 def tags(self): | 1972 def tags(self): |
1973 if self.tagscache: | 1973 if self.tagscache: |
1974 return self.tagscache | 1974 return self.tagscache |
1975 | 1975 |
1976 tagscache = super(mqrepo, self).tags() | 1976 tagscache = super(mqrepo, self).tags() |