Show More
@@ -0,0 +1,35 b'' | |||||
|
1 | #!/bin/sh | |||
|
2 | ||||
|
3 | echo "[extensions]" >> $HGRCPATH | |||
|
4 | echo "mq=" >> $HGRCPATH | |||
|
5 | ||||
|
6 | hg init a | |||
|
7 | cd a | |||
|
8 | ||||
|
9 | echo 'base' > base | |||
|
10 | hg ci -Ambase -d '1 0' | |||
|
11 | ||||
|
12 | hg qnew a | |||
|
13 | hg qnew b | |||
|
14 | hg qnew c | |||
|
15 | ||||
|
16 | hg qdel c | |||
|
17 | hg qpop | |||
|
18 | hg qdel c | |||
|
19 | hg qseries | |||
|
20 | ls .hg/patches | |||
|
21 | hg qpop | |||
|
22 | hg qdel -k b | |||
|
23 | ls .hg/patches | |||
|
24 | hg qdel -f a | |||
|
25 | hg qapplied | |||
|
26 | hg log --template '{rev} {desc}\n' | |||
|
27 | ||||
|
28 | hg qnew d | |||
|
29 | hg qnew e | |||
|
30 | hg qnew f | |||
|
31 | ||||
|
32 | hg qdel -f e | |||
|
33 | hg qdel -f d e | |||
|
34 | hg qapplied | |||
|
35 | hg log --template '{rev} {desc}\n' |
@@ -0,0 +1,23 b'' | |||||
|
1 | adding base | |||
|
2 | abort: cannot delete applied patch c | |||
|
3 | Now at: b | |||
|
4 | a | |||
|
5 | b | |||
|
6 | a | |||
|
7 | b | |||
|
8 | series | |||
|
9 | status | |||
|
10 | Now at: a | |||
|
11 | a | |||
|
12 | b | |||
|
13 | series | |||
|
14 | status | |||
|
15 | 1 New patch: a | |||
|
16 | 0 base | |||
|
17 | abort: patch e not at base | |||
|
18 | f | |||
|
19 | 4 New patch: f | |||
|
20 | 3 New patch: e | |||
|
21 | 2 New patch: d | |||
|
22 | 1 New patch: a | |||
|
23 | 0 base |
@@ -0,0 +1,25 b'' | |||||
|
1 | #!/bin/sh | |||
|
2 | ||||
|
3 | echo "[extensions]" >> $HGRCPATH | |||
|
4 | echo "mq=" >> $HGRCPATH | |||
|
5 | ||||
|
6 | hg init a | |||
|
7 | cd a | |||
|
8 | ||||
|
9 | echo 'base' > base | |||
|
10 | hg ci -Ambase -d '1 0' | |||
|
11 | ||||
|
12 | hg qnew -mmqbase mqbase | |||
|
13 | hg qrename mqbase renamed | |||
|
14 | mkdir .hg/patches/foo | |||
|
15 | hg qrename renamed foo | |||
|
16 | hg qseries | |||
|
17 | ls .hg/patches/foo | |||
|
18 | mkdir .hg/patches/bar | |||
|
19 | hg qrename foo/renamed bar | |||
|
20 | hg qseries | |||
|
21 | ls .hg/patches/bar | |||
|
22 | hg qrename bar/renamed baz | |||
|
23 | hg qseries | |||
|
24 | ls .hg/patches/baz | |||
|
25 |
@@ -0,0 +1,7 b'' | |||||
|
1 | adding base | |||
|
2 | foo/renamed | |||
|
3 | renamed | |||
|
4 | bar/renamed | |||
|
5 | renamed | |||
|
6 | baz | |||
|
7 | .hg/patches/baz |
@@ -14,7 +14,7 b'' | |||||
14 | from mercurial.demandload import * |
|
14 | from mercurial.demandload import * | |
15 | from mercurial.i18n import gettext as _ |
|
15 | from mercurial.i18n import gettext as _ | |
16 | demandload(globals(), 'time sys signal os') |
|
16 | demandload(globals(), 'time sys signal os') | |
17 |
demandload(globals(), 'mercurial:hg,mdiff,fancyopts,c |
|
17 | demandload(globals(), 'mercurial:hg,mdiff,fancyopts,cmdutil,ui,util,templater,node') | |
18 |
|
18 | |||
19 | def __gather(ui, repo, node1, node2): |
|
19 | def __gather(ui, repo, node1, node2): | |
20 | def dirtywork(f, mmap1, mmap2): |
|
20 | def dirtywork(f, mmap1, mmap2): | |
@@ -150,7 +150,7 b' def churn(ui, repo, **opts):' | |||||
150 | amap = get_aliases(f) |
|
150 | amap = get_aliases(f) | |
151 | f.close() |
|
151 | f.close() | |
152 |
|
152 | |||
153 |
revs = [int(r) for r in c |
|
153 | revs = [int(r) for r in cmdutil.revrange(ui, repo, opts['rev'])] | |
154 | revs.sort() |
|
154 | revs.sort() | |
155 | stats = gather_stats(ui, repo, amap, revs, opts.get('progress')) |
|
155 | stats = gather_stats(ui, repo, amap, revs, opts.get('progress')) | |
156 |
|
156 |
@@ -45,7 +45,7 b'' | |||||
45 | from mercurial.demandload import demandload |
|
45 | from mercurial.demandload import demandload | |
46 | from mercurial.i18n import gettext as _ |
|
46 | from mercurial.i18n import gettext as _ | |
47 | from mercurial.node import * |
|
47 | from mercurial.node import * | |
48 |
demandload(globals(), 'mercurial:c |
|
48 | demandload(globals(), 'mercurial:cmdutil,util os shutil tempfile') | |
49 |
|
49 | |||
50 | def dodiff(ui, repo, diffcmd, diffopts, pats, opts): |
|
50 | def dodiff(ui, repo, diffcmd, diffopts, pats, opts): | |
51 | def snapshot_node(files, node): |
|
51 | def snapshot_node(files, node): | |
@@ -90,7 +90,7 b' def dodiff(ui, repo, diffcmd, diffopts, ' | |||||
90 | fp.write(chunk) |
|
90 | fp.write(chunk) | |
91 | return dirname |
|
91 | return dirname | |
92 |
|
92 | |||
93 |
node1, node2 = c |
|
93 | node1, node2 = cmdutil.revpair(ui, repo, opts['rev']) | |
94 | files, matchfn, anypats = cmdutil.matchpats(repo, pats, opts) |
|
94 | files, matchfn, anypats = cmdutil.matchpats(repo, pats, opts) | |
95 | modified, added, removed, deleted, unknown = repo.status( |
|
95 | modified, added, removed, deleted, unknown = repo.status( | |
96 | node1, node2, files, match=matchfn)[:5] |
|
96 | node1, node2, files, match=matchfn)[:5] |
@@ -40,7 +40,7 b' commands.norepo += " qclone qversion"' | |||||
40 | class statusentry: |
|
40 | class statusentry: | |
41 | def __init__(self, rev, name=None): |
|
41 | def __init__(self, rev, name=None): | |
42 | if not name: |
|
42 | if not name: | |
43 | fields = rev.split(':') |
|
43 | fields = rev.split(':', 1) | |
44 | if len(fields) == 2: |
|
44 | if len(fields) == 2: | |
45 | self.rev, self.name = fields |
|
45 | self.rev, self.name = fields | |
46 | else: |
|
46 | else: | |
@@ -483,24 +483,35 b' class queue:' | |||||
483 | tr.close() |
|
483 | tr.close() | |
484 | return (err, n) |
|
484 | return (err, n) | |
485 |
|
485 | |||
486 |
def delete(self, repo, patches, |
|
486 | def delete(self, repo, patches, opts): | |
487 | realpatches = [] |
|
487 | realpatches = [] | |
|
488 | appliedbase = 0 | |||
|
489 | forget = opts.get('forget') | |||
488 | for patch in patches: |
|
490 | for patch in patches: | |
489 | patch = self.lookup(patch, strict=True) |
|
491 | patch = self.lookup(patch, strict=True) | |
490 | info = self.isapplied(patch) |
|
492 | info = self.isapplied(patch) | |
491 | if info: |
|
493 | if info and not forget: | |
492 | raise util.Abort(_("cannot delete applied patch %s") % patch) |
|
494 | raise util.Abort(_("cannot delete applied patch %s") % patch) | |
493 | if patch not in self.series: |
|
495 | if patch not in self.series: | |
494 | raise util.Abort(_("patch %s not in series file") % patch) |
|
496 | raise util.Abort(_("patch %s not in series file") % patch) | |
|
497 | if forget: | |||
|
498 | if not info: | |||
|
499 | raise util.Abort(_("cannot forget unapplied patch %s") % patch) | |||
|
500 | if info[0] != appliedbase: | |||
|
501 | raise util.Abort(_("patch %s not at base") % patch) | |||
|
502 | appliedbase += 1 | |||
495 | realpatches.append(patch) |
|
503 | realpatches.append(patch) | |
496 |
|
504 | |||
497 | if not keep: |
|
505 | if not opts.get('keep'): | |
498 | r = self.qrepo() |
|
506 | r = self.qrepo() | |
499 | if r: |
|
507 | if r: | |
500 | r.remove(realpatches, True) |
|
508 | r.remove(realpatches, True) | |
501 | else: |
|
509 | else: | |
502 | os.unlink(self.join(patch)) |
|
510 | os.unlink(self.join(patch)) | |
503 |
|
511 | |||
|
512 | if forget: | |||
|
513 | del self.applied[:appliedbase] | |||
|
514 | self.applied_dirty = 1 | |||
504 | indices = [self.find_series(p) for p in realpatches] |
|
515 | indices = [self.find_series(p) for p in realpatches] | |
505 | indices.sort() |
|
516 | indices.sort() | |
506 | for i in indices[-1::-1]: |
|
517 | for i in indices[-1::-1]: | |
@@ -995,6 +1006,8 b' class queue:' | |||||
995 | r = list(util.unique(dd)) |
|
1006 | r = list(util.unique(dd)) | |
996 | a = list(util.unique(aa)) |
|
1007 | a = list(util.unique(aa)) | |
997 | filelist = filter(matchfn, util.unique(m + r + a)) |
|
1008 | filelist = filter(matchfn, util.unique(m + r + a)) | |
|
1009 | if opts.get('git'): | |||
|
1010 | self.diffopts().git = True | |||
998 | patch.diff(repo, patchparent, files=filelist, match=matchfn, |
|
1011 | patch.diff(repo, patchparent, files=filelist, match=matchfn, | |
999 | fp=patchf, changes=(m, a, r, [], u), |
|
1012 | fp=patchf, changes=(m, a, r, [], u), | |
1000 | opts=self.diffopts()) |
|
1013 | opts=self.diffopts()) | |
@@ -1304,10 +1317,15 b' class queue:' | |||||
1304 | def delete(ui, repo, patch, *patches, **opts): |
|
1317 | def delete(ui, repo, patch, *patches, **opts): | |
1305 | """remove patches from queue |
|
1318 | """remove patches from queue | |
1306 |
|
1319 | |||
1307 | The patches must not be applied. |
|
1320 | With --forget, mq will stop managing the named patches. The | |
1308 | With -k, the patch files are preserved in the patch directory.""" |
|
1321 | patches must be applied and at the base of the stack. This option | |
|
1322 | is useful when the patches have been applied upstream. | |||
|
1323 | ||||
|
1324 | Otherwise, the patches must not be applied. | |||
|
1325 | ||||
|
1326 | With --keep, the patch files are preserved in the patch directory.""" | |||
1309 | q = repo.mq |
|
1327 | q = repo.mq | |
1310 |
q.delete(repo, (patch,) + patches, |
|
1328 | q.delete(repo, (patch,) + patches, opts) | |
1311 | q.save_dirty() |
|
1329 | q.save_dirty() | |
1312 | return 0 |
|
1330 | return 0 | |
1313 |
|
1331 | |||
@@ -1651,13 +1669,6 b' def rename(ui, repo, patch, name=None, *' | |||||
1651 | name = patch |
|
1669 | name = patch | |
1652 | patch = None |
|
1670 | patch = None | |
1653 |
|
1671 | |||
1654 | if name in q.series: |
|
|||
1655 | raise util.Abort(_('A patch named %s already exists in the series file') % name) |
|
|||
1656 |
|
||||
1657 | absdest = q.join(name) |
|
|||
1658 | if os.path.exists(absdest): |
|
|||
1659 | raise util.Abort(_('%s already exists') % absdest) |
|
|||
1660 |
|
||||
1661 | if patch: |
|
1672 | if patch: | |
1662 | patch = q.lookup(patch) |
|
1673 | patch = q.lookup(patch) | |
1663 | else: |
|
1674 | else: | |
@@ -1665,6 +1676,15 b' def rename(ui, repo, patch, name=None, *' | |||||
1665 | ui.write(_('No patches applied\n')) |
|
1676 | ui.write(_('No patches applied\n')) | |
1666 | return |
|
1677 | return | |
1667 | patch = q.lookup('qtip') |
|
1678 | patch = q.lookup('qtip') | |
|
1679 | absdest = q.join(name) | |||
|
1680 | if os.path.isdir(absdest): | |||
|
1681 | name = os.path.join(name, os.path.basename(patch)) | |||
|
1682 | absdest = q.join(name) | |||
|
1683 | if os.path.exists(absdest): | |||
|
1684 | raise util.Abort(_('%s already exists') % absdest) | |||
|
1685 | ||||
|
1686 | if name in q.series: | |||
|
1687 | raise util.Abort(_('A patch named %s already exists in the series file') % name) | |||
1668 |
|
1688 | |||
1669 | if ui.verbose: |
|
1689 | if ui.verbose: | |
1670 | ui.write('Renaming %s to %s\n' % (patch, name)) |
|
1690 | ui.write('Renaming %s to %s\n' % (patch, name)) | |
@@ -1736,7 +1756,8 b' def strip(ui, repo, rev, **opts):' | |||||
1736 | backup = 'strip' |
|
1756 | backup = 'strip' | |
1737 | elif opts['nobackup']: |
|
1757 | elif opts['nobackup']: | |
1738 | backup = 'none' |
|
1758 | backup = 'none' | |
1739 | repo.mq.strip(repo, rev, backup=backup) |
|
1759 | update = repo.dirstate.parents()[0] != revlog.nullid | |
|
1760 | repo.mq.strip(repo, rev, backup=backup, update=update) | |||
1740 | return 0 |
|
1761 | return 0 | |
1741 |
|
1762 | |||
1742 | def select(ui, repo, *args, **opts): |
|
1763 | def select(ui, repo, *args, **opts): | |
@@ -1912,8 +1933,9 b' cmdtable = {' | |||||
1912 | 'hg qdiff [-I] [-X] [FILE]...'), |
|
1933 | 'hg qdiff [-I] [-X] [FILE]...'), | |
1913 | "qdelete|qremove|qrm": |
|
1934 | "qdelete|qremove|qrm": | |
1914 | (delete, |
|
1935 | (delete, | |
1915 |
[(' |
|
1936 | [('f', 'forget', None, _('stop managing an applied patch')), | |
1916 | 'hg qdelete [-k] PATCH'), |
|
1937 | ('k', 'keep', None, _('keep patch file'))], | |
|
1938 | 'hg qdelete [-f] [-k] PATCH'), | |||
1917 | 'qfold': |
|
1939 | 'qfold': | |
1918 | (fold, |
|
1940 | (fold, | |
1919 | [('e', 'edit', None, _('edit patch header')), |
|
1941 | [('e', 'edit', None, _('edit patch header')), | |
@@ -1964,6 +1986,7 b' cmdtable = {' | |||||
1964 | [('e', 'edit', None, _('edit commit message')), |
|
1986 | [('e', 'edit', None, _('edit commit message')), | |
1965 | ('m', 'message', '', _('change commit message with <text>')), |
|
1987 | ('m', 'message', '', _('change commit message with <text>')), | |
1966 | ('l', 'logfile', '', _('change commit message with <file> content')), |
|
1988 | ('l', 'logfile', '', _('change commit message with <file> content')), | |
|
1989 | ('g', 'git', None, _('use git extended diff format')), | |||
1967 | ('s', 'short', None, 'short refresh'), |
|
1990 | ('s', 'short', None, 'short refresh'), | |
1968 | ('I', 'include', [], _('include names matching the given patterns')), |
|
1991 | ('I', 'include', [], _('include names matching the given patterns')), | |
1969 | ('X', 'exclude', [], _('exclude names matching the given patterns'))], |
|
1992 | ('X', 'exclude', [], _('exclude names matching the given patterns'))], | |
@@ -1995,7 +2018,7 b' cmdtable = {' | |||||
1995 | (series, |
|
2018 | (series, | |
1996 | [('m', 'missing', None, 'print patches not in series'), |
|
2019 | [('m', 'missing', None, 'print patches not in series'), | |
1997 | ('s', 'summary', None, _('print first line of patch header'))], |
|
2020 | ('s', 'summary', None, _('print first line of patch header'))], | |
1998 | 'hg qseries [-m]'), |
|
2021 | 'hg qseries [-ms]'), | |
1999 | "^strip": |
|
2022 | "^strip": | |
2000 | (strip, |
|
2023 | (strip, | |
2001 | [('f', 'force', None, 'force multi-head removal'), |
|
2024 | [('f', 'force', None, 'force multi-head removal'), |
@@ -11,6 +11,76 b' from i18n import gettext as _' | |||||
11 | demandload(globals(), 'mdiff util') |
|
11 | demandload(globals(), 'mdiff util') | |
12 | demandload(globals(), 'os sys') |
|
12 | demandload(globals(), 'os sys') | |
13 |
|
13 | |||
|
14 | revrangesep = ':' | |||
|
15 | ||||
|
16 | def revfix(repo, val, defval): | |||
|
17 | '''turn user-level id of changeset into rev number. | |||
|
18 | user-level id can be tag, changeset, rev number, or negative rev | |||
|
19 | number relative to number of revs (-1 is tip, etc).''' | |||
|
20 | if not val: | |||
|
21 | return defval | |||
|
22 | try: | |||
|
23 | num = int(val) | |||
|
24 | if str(num) != val: | |||
|
25 | raise ValueError | |||
|
26 | if num < 0: | |||
|
27 | num += repo.changelog.count() | |||
|
28 | if num < 0: | |||
|
29 | num = 0 | |||
|
30 | elif num >= repo.changelog.count(): | |||
|
31 | raise ValueError | |||
|
32 | except ValueError: | |||
|
33 | try: | |||
|
34 | num = repo.changelog.rev(repo.lookup(val)) | |||
|
35 | except KeyError: | |||
|
36 | raise util.Abort(_('invalid revision identifier %s') % val) | |||
|
37 | return num | |||
|
38 | ||||
|
39 | def revpair(ui, repo, revs): | |||
|
40 | '''return pair of nodes, given list of revisions. second item can | |||
|
41 | be None, meaning use working dir.''' | |||
|
42 | if not revs: | |||
|
43 | return repo.dirstate.parents()[0], None | |||
|
44 | end = None | |||
|
45 | if len(revs) == 1: | |||
|
46 | start = revs[0] | |||
|
47 | if revrangesep in start: | |||
|
48 | start, end = start.split(revrangesep, 1) | |||
|
49 | start = revfix(repo, start, 0) | |||
|
50 | end = revfix(repo, end, repo.changelog.count() - 1) | |||
|
51 | else: | |||
|
52 | start = revfix(repo, start, None) | |||
|
53 | elif len(revs) == 2: | |||
|
54 | if revrangesep in revs[0] or revrangesep in revs[1]: | |||
|
55 | raise util.Abort(_('too many revisions specified')) | |||
|
56 | start = revfix(repo, revs[0], None) | |||
|
57 | end = revfix(repo, revs[1], None) | |||
|
58 | else: | |||
|
59 | raise util.Abort(_('too many revisions specified')) | |||
|
60 | if end is not None: end = repo.lookup(str(end)) | |||
|
61 | return repo.lookup(str(start)), end | |||
|
62 | ||||
|
63 | def revrange(ui, repo, revs): | |||
|
64 | """Yield revision as strings from a list of revision specifications.""" | |||
|
65 | seen = {} | |||
|
66 | for spec in revs: | |||
|
67 | if revrangesep in spec: | |||
|
68 | start, end = spec.split(revrangesep, 1) | |||
|
69 | start = revfix(repo, start, 0) | |||
|
70 | end = revfix(repo, end, repo.changelog.count() - 1) | |||
|
71 | step = start > end and -1 or 1 | |||
|
72 | for rev in xrange(start, end+step, step): | |||
|
73 | if rev in seen: | |||
|
74 | continue | |||
|
75 | seen[rev] = 1 | |||
|
76 | yield str(rev) | |||
|
77 | else: | |||
|
78 | rev = revfix(repo, spec, None) | |||
|
79 | if rev in seen: | |||
|
80 | continue | |||
|
81 | seen[rev] = 1 | |||
|
82 | yield str(rev) | |||
|
83 | ||||
14 | def make_filename(repo, pat, node, |
|
84 | def make_filename(repo, pat, node, | |
15 | total=None, seqno=None, revwidth=None, pathname=None): |
|
85 | total=None, seqno=None, revwidth=None, pathname=None): | |
16 | node_expander = { |
|
86 | node_expander = { |
@@ -108,7 +108,7 b' def walkchangerevs(ui, repo, pats, opts)' | |||||
108 | defrange = '%s:0' % start |
|
108 | defrange = '%s:0' % start | |
109 | else: |
|
109 | else: | |
110 | defrange = 'tip:0' |
|
110 | defrange = 'tip:0' | |
111 | revs = map(int, revrange(ui, repo, opts['rev'] or [defrange])) |
|
111 | revs = map(int, cmdutil.revrange(ui, repo, opts['rev'] or [defrange])) | |
112 | wanted = {} |
|
112 | wanted = {} | |
113 | slowpath = anypats |
|
113 | slowpath = anypats | |
114 | fncache = {} |
|
114 | fncache = {} | |
@@ -252,76 +252,6 b' def walkchangerevs(ui, repo, pats, opts)' | |||||
252 | yield 'iter', rev, None |
|
252 | yield 'iter', rev, None | |
253 | return iterate(), getchange, matchfn |
|
253 | return iterate(), getchange, matchfn | |
254 |
|
254 | |||
255 | revrangesep = ':' |
|
|||
256 |
|
||||
257 | def revfix(repo, val, defval): |
|
|||
258 | '''turn user-level id of changeset into rev number. |
|
|||
259 | user-level id can be tag, changeset, rev number, or negative rev |
|
|||
260 | number relative to number of revs (-1 is tip, etc).''' |
|
|||
261 | if not val: |
|
|||
262 | return defval |
|
|||
263 | try: |
|
|||
264 | num = int(val) |
|
|||
265 | if str(num) != val: |
|
|||
266 | raise ValueError |
|
|||
267 | if num < 0: |
|
|||
268 | num += repo.changelog.count() |
|
|||
269 | if num < 0: |
|
|||
270 | num = 0 |
|
|||
271 | elif num >= repo.changelog.count(): |
|
|||
272 | raise ValueError |
|
|||
273 | except ValueError: |
|
|||
274 | try: |
|
|||
275 | num = repo.changelog.rev(repo.lookup(val)) |
|
|||
276 | except KeyError: |
|
|||
277 | raise util.Abort(_('invalid revision identifier %s') % val) |
|
|||
278 | return num |
|
|||
279 |
|
||||
280 | def revpair(ui, repo, revs): |
|
|||
281 | '''return pair of nodes, given list of revisions. second item can |
|
|||
282 | be None, meaning use working dir.''' |
|
|||
283 | if not revs: |
|
|||
284 | return repo.dirstate.parents()[0], None |
|
|||
285 | end = None |
|
|||
286 | if len(revs) == 1: |
|
|||
287 | start = revs[0] |
|
|||
288 | if revrangesep in start: |
|
|||
289 | start, end = start.split(revrangesep, 1) |
|
|||
290 | start = revfix(repo, start, 0) |
|
|||
291 | end = revfix(repo, end, repo.changelog.count() - 1) |
|
|||
292 | else: |
|
|||
293 | start = revfix(repo, start, None) |
|
|||
294 | elif len(revs) == 2: |
|
|||
295 | if revrangesep in revs[0] or revrangesep in revs[1]: |
|
|||
296 | raise util.Abort(_('too many revisions specified')) |
|
|||
297 | start = revfix(repo, revs[0], None) |
|
|||
298 | end = revfix(repo, revs[1], None) |
|
|||
299 | else: |
|
|||
300 | raise util.Abort(_('too many revisions specified')) |
|
|||
301 | if end is not None: end = repo.lookup(str(end)) |
|
|||
302 | return repo.lookup(str(start)), end |
|
|||
303 |
|
||||
304 | def revrange(ui, repo, revs): |
|
|||
305 | """Yield revision as strings from a list of revision specifications.""" |
|
|||
306 | seen = {} |
|
|||
307 | for spec in revs: |
|
|||
308 | if revrangesep in spec: |
|
|||
309 | start, end = spec.split(revrangesep, 1) |
|
|||
310 | start = revfix(repo, start, 0) |
|
|||
311 | end = revfix(repo, end, repo.changelog.count() - 1) |
|
|||
312 | step = start > end and -1 or 1 |
|
|||
313 | for rev in xrange(start, end+step, step): |
|
|||
314 | if rev in seen: |
|
|||
315 | continue |
|
|||
316 | seen[rev] = 1 |
|
|||
317 | yield str(rev) |
|
|||
318 | else: |
|
|||
319 | rev = revfix(repo, spec, None) |
|
|||
320 | if rev in seen: |
|
|||
321 | continue |
|
|||
322 | seen[rev] = 1 |
|
|||
323 | yield str(rev) |
|
|||
324 |
|
||||
325 | def write_bundle(cg, filename=None, compress=True): |
|
255 | def write_bundle(cg, filename=None, compress=True): | |
326 | """Write a bundle file and return its filename. |
|
256 | """Write a bundle file and return its filename. | |
327 |
|
257 | |||
@@ -1344,7 +1274,7 b' def diff(ui, repo, *pats, **opts):' | |||||
1344 | it detects as binary. With -a, diff will generate a diff anyway, |
|
1274 | it detects as binary. With -a, diff will generate a diff anyway, | |
1345 | probably with undesirable results. |
|
1275 | probably with undesirable results. | |
1346 | """ |
|
1276 | """ | |
1347 | node1, node2 = revpair(ui, repo, opts['rev']) |
|
1277 | node1, node2 = cmdutil.revpair(ui, repo, opts['rev']) | |
1348 |
|
1278 | |||
1349 | fns, matchfn, anypats = cmdutil.matchpats(repo, pats, opts) |
|
1279 | fns, matchfn, anypats = cmdutil.matchpats(repo, pats, opts) | |
1350 |
|
1280 | |||
@@ -1380,7 +1310,7 b' def export(ui, repo, *changesets, **opts' | |||||
1380 | """ |
|
1310 | """ | |
1381 | if not changesets: |
|
1311 | if not changesets: | |
1382 | raise util.Abort(_("export requires at least one changeset")) |
|
1312 | raise util.Abort(_("export requires at least one changeset")) | |
1383 | revs = list(revrange(ui, repo, changesets)) |
|
1313 | revs = list(cmdutil.revrange(ui, repo, changesets)) | |
1384 | if len(revs) > 1: |
|
1314 | if len(revs) > 1: | |
1385 | ui.note(_('exporting patches:\n')) |
|
1315 | ui.note(_('exporting patches:\n')) | |
1386 | else: |
|
1316 | else: |
@@ -143,7 +143,7 b' class lazyparser(object):' | |||||
143 | # the revlog may have grown since we've started running, |
|
143 | # the revlog may have grown since we've started running, | |
144 | # but we don't have space in self.index for more entries. |
|
144 | # but we don't have space in self.index for more entries. | |
145 | # limit blocksize so that we don't get too much data. |
|
145 | # limit blocksize so that we don't get too much data. | |
146 | blocksize = self.datasize - blockstart |
|
146 | blocksize = max(self.datasize - blockstart, 0) | |
147 | data = self.dataf.read(blocksize) |
|
147 | data = self.dataf.read(blocksize) | |
148 | lend = len(data) / self.s |
|
148 | lend = len(data) / self.s | |
149 | i = blockstart / self.s |
|
149 | i = blockstart / self.s |
@@ -32,13 +32,6 b' class sshrepository(remoterepository):' | |||||
32 | remotecmd = self.ui.config("ui", "remotecmd", "hg") |
|
32 | remotecmd = self.ui.config("ui", "remotecmd", "hg") | |
33 |
|
33 | |||
34 | if create: |
|
34 | if create: | |
35 | try: |
|
|||
36 | self.validate_repo(ui, sshcmd, args, remotecmd) |
|
|||
37 | except hg.RepoError: |
|
|||
38 | pass |
|
|||
39 | else: |
|
|||
40 | raise hg.RepoError(_("repository %s already exists") % path) |
|
|||
41 |
|
||||
42 | cmd = '%s %s "%s init %s"' |
|
35 | cmd = '%s %s "%s init %s"' | |
43 | cmd = cmd % (sshcmd, args, remotecmd, self.path) |
|
36 | cmd = cmd % (sshcmd, args, remotecmd, self.path) | |
44 |
|
37 |
@@ -3,7 +3,6 b' adding foo' | |||||
3 | #test failure |
|
3 | #test failure | |
4 | abort: repository local already exists! |
|
4 | abort: repository local already exists! | |
5 | # init+push to remote2 |
|
5 | # init+push to remote2 | |
6 | remote: abort: repository remote2 not found! |
|
|||
7 | changeset: 0:c4e059d443be |
|
6 | changeset: 0:c4e059d443be | |
8 | tag: tip |
|
7 | tag: tip | |
9 | user: test |
|
8 | user: test | |
@@ -17,26 +16,25 b' remote: adding manifests' | |||||
17 | remote: adding file changes |
|
16 | remote: adding file changes | |
18 | remote: added 1 changesets with 1 changes to 1 files |
|
17 | remote: added 1 changesets with 1 changes to 1 files | |
19 | # clone to remote1 |
|
18 | # clone to remote1 | |
20 | remote: abort: repository remote1 not found! |
|
|||
21 | searching for changes |
|
19 | searching for changes | |
22 | remote: adding changesets |
|
20 | remote: adding changesets | |
23 | remote: adding manifests |
|
21 | remote: adding manifests | |
24 | remote: adding file changes |
|
22 | remote: adding file changes | |
25 | remote: added 1 changesets with 1 changes to 1 files |
|
23 | remote: added 1 changesets with 1 changes to 1 files | |
26 | # init to existing repo |
|
24 | # init to existing repo | |
27 |
abort: repository |
|
25 | abort: repository remote1 already exists! | |
|
26 | abort: could not create remote repo! | |||
28 | # clone to existing repo |
|
27 | # clone to existing repo | |
29 |
abort: repository |
|
28 | abort: repository remote1 already exists! | |
|
29 | abort: could not create remote repo! | |||
30 | # output of dummyssh |
|
30 | # output of dummyssh | |
31 | Got arguments 1:user@dummy 2:hg -R remote2 serve --stdio 3: 4: 5: |
|
|||
32 | Got arguments 1:user@dummy 2:hg init remote2 3: 4: 5: |
|
31 | Got arguments 1:user@dummy 2:hg init remote2 3: 4: 5: | |
33 | Got arguments 1:user@dummy 2:hg -R remote2 serve --stdio 3: 4: 5: |
|
32 | Got arguments 1:user@dummy 2:hg -R remote2 serve --stdio 3: 4: 5: | |
34 | Got arguments 1:user@dummy 2:hg -R remote2 serve --stdio 3: 4: 5: |
|
33 | Got arguments 1:user@dummy 2:hg -R remote2 serve --stdio 3: 4: 5: | |
35 | Got arguments 1:user@dummy 2:hg -R remote1 serve --stdio 3: 4: 5: |
|
|||
36 | Got arguments 1:user@dummy 2:hg init remote1 3: 4: 5: |
|
34 | Got arguments 1:user@dummy 2:hg init remote1 3: 4: 5: | |
37 | Got arguments 1:user@dummy 2:hg -R remote1 serve --stdio 3: 4: 5: |
|
35 | Got arguments 1:user@dummy 2:hg -R remote1 serve --stdio 3: 4: 5: | |
38 |
Got arguments 1:user@dummy 2:hg |
|
36 | Got arguments 1:user@dummy 2:hg init remote1 3: 4: 5: | |
39 |
Got arguments 1:user@dummy 2:hg |
|
37 | Got arguments 1:user@dummy 2:hg init remote1 3: 4: 5: | |
40 | # comparing repositories |
|
38 | # comparing repositories | |
41 | 0:c4e059d443be |
|
39 | 0:c4e059d443be | |
42 | 0:c4e059d443be |
|
40 | 0:c4e059d443be |
General Comments 0
You need to be logged in to leave comments.
Login now