Mercurial > evolve
changeset 702:b5a85a8909d3 stable
touch: properly handle touching multiple changeset
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Fri, 08 Feb 2013 22:44:43 +0000 |
parents | f752089479ce |
children | 60582b861a00 |
files | README hgext/evolve.py tests/test-evolve.t tests/test-touch.t |
diffstat | 4 files changed, 63 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/README Fri Feb 08 22:12:46 2013 +0000 +++ b/README Fri Feb 08 22:44:43 2013 +0000 @@ -50,6 +50,7 @@ - amend: drop deprecated --change option for amend - alias: add a grab aliast to be used instead of graft -O - touch: add a --duplicate option to *not* obsolete the old version +- touch: fix touching multiple revision at the same time 3.0.0 -- 2013-02-02
--- a/hgext/evolve.py Fri Feb 08 22:12:46 2013 +0000 +++ b/hgext/evolve.py Fri Feb 08 22:44:43 2013 +0000 @@ -1594,14 +1594,23 @@ wlock = repo.wlock() lock = repo.lock() tr = repo.transaction('touch') + revs.sort() # ensure parent are run first + newmapping = {} try: for r in revs: ctx = repo[r] extra = ctx.extra().copy() extra['__touch-noise__'] = random.randint(0, 0xffffffff) + # search for touched parent + p1 = ctx.p1().node() + p2 = ctx.p2().node() + p1 = newmapping.get(p1, p1) + p2 = newmapping.get(p2, p2) new, _ = rewrite(repo, ctx, [], ctx, - [ctx.p1().node(), ctx.p2().node()], + [p1, p2], commitopts={'extra': extra}) + # store touched version to help potential children + newmapping[ctx.node()] = new if not duplicate: createmarkers(repo, [(ctx, (repo[new],))]) phases.retractboundary(repo, ctx.phase(), [new]) @@ -1614,16 +1623,29 @@ lockmod.release(lock, wlock) @command('^fold', - [('r', 'rev', [], _("revisions to fold")), + [('r', 'rev', [], _("explicitly specify the full set of revision to fold")), ], # allow to choose the seed ? - _('[-r] revs')) + _('rev')) def fold(ui, repo, *revs, **opts): - """Fold multiple revisions into a single one""" + """Fold multiple revisions into a single one + + Revision from your current working directory to the specified one are fold + as a new one replacing the other + + you can alternatively use --rev to explicitly specify revision to be fold + ignoring the current working directory parent. + """ revs = list(revs) - revs.extend(opts['rev']) if revs: - revs = scmutil.revrange(repo, revs) + if opts.get('rev', ()): + raise util.Abort("cannot specify both --rev and a target revision") + targets = scmutil.revrange(repo, revs) + revs = repo.revs('(%ld::.) or (.::%ld)', targets, targets) + elif 'rev' in opts: + revs = scmutil.revrange(repo, opts['rev']) + else: + revs = () if not revs: ui.write_err('no revision to fold\n') return 1
--- a/tests/test-evolve.t Fri Feb 08 22:12:46 2013 +0000 +++ b/tests/test-evolve.t Fri Feb 08 22:44:43 2013 +0000 @@ -558,7 +558,10 @@ $ hg fold no revision to fold [1] - $ hg fold 6::10 + $ hg fold 6 --rev 10 + abort: cannot specify both --rev and a target revision + [255] + $ hg fold 6 # want to run hg fold 6 2 changesets folded 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ glog @@ -584,7 +587,7 @@ $ hg up 4 0 files updated, 0 files merged, 2 files removed, 0 files unresolved - $ hg fold 4::11 + $ hg fold --rev 4::11 3 changesets folded 2 files updated, 0 files merged, 0 files removed, 0 files unresolved $ glog
--- a/tests/test-touch.t Fri Feb 08 22:12:46 2013 +0000 +++ b/tests/test-touch.t Fri Feb 08 22:44:43 2013 +0000 @@ -57,3 +57,32 @@ o 4:[0-9a-f]{12} a (re) + +Multiple touch + + $ echo C > c + $ hg add c + $ hg commit -m c + $ echo D > d + $ hg add d + $ hg commit -m d + $ hg log -G + @ 7:[0-9a-f]{12} d (re) + | + o 6:[0-9a-f]{12} c (re) + | + o 5:[0-9a-f]{12} a (re) + + o 4:[0-9a-f]{12} a (re) + + $ hg touch 6:7 + $ hg log -G + @ 9:[0-9a-f]{12} d (re) + | + o 8:[0-9a-f]{12} c (re) + | + o 5:[0-9a-f]{12} a (re) + + o 4:[0-9a-f]{12} a (re) + +