Mercurial > hg-stable
changeset 16389:79fecd735d26
graft: add --dry-run support (issue3362)
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Tue, 10 Apr 2012 12:49:12 -0500 |
parents | e03d8a40521f |
children | 4df76d5506a9 |
files | mercurial/commands.py tests/test-debugcomplete.t tests/test-graft.t |
diffstat | 3 files changed, 14 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Fri Apr 06 16:18:33 2012 +0300 +++ b/mercurial/commands.py Tue Apr 10 12:49:12 2012 -0500 @@ -2492,7 +2492,7 @@ _('record the current date as commit date')), ('U', 'currentuser', False, _('record the current user as committer'), _('DATE'))] - + commitopts2 + mergetoolopts, + + commitopts2 + mergetoolopts + dryrunopts, _('[OPTION]... REVISION...')) def graft(ui, repo, *revs, **opts): '''copy changes from other branches onto the current branch @@ -2611,7 +2611,10 @@ for pos, ctx in enumerate(repo.set("%ld", revs)): current = repo['.'] + ui.status(_('grafting revision %s\n') % ctx.rev()) + if opts.get('dry_run'): + continue # we don't merge the first commit when continuing if not cont: @@ -2654,7 +2657,7 @@ date=date, extra=extra, editor=editor) # remove state when we complete successfully - if os.path.exists(repo.join('graftstate')): + if not opts.get('dry_run') and os.path.exists(repo.join('graftstate')): util.unlinkpath(repo.join('graftstate')) return 0
--- a/tests/test-debugcomplete.t Fri Apr 06 16:18:33 2012 +0300 +++ b/tests/test-debugcomplete.t Tue Apr 10 12:49:12 2012 -0500 @@ -247,7 +247,7 @@ debugsub: rev debugwalk: include, exclude debugwireargs: three, four, five, ssh, remotecmd, insecure - graft: continue, edit, currentdate, currentuser, date, user, tool + graft: continue, edit, currentdate, currentuser, date, user, tool, dry-run grep: print0, all, text, follow, ignore-case, files-with-matches, line-number, rev, user, date, include, exclude heads: rev, topo, active, closed, style, template help: extension, command
--- a/tests/test-graft.t Fri Apr 06 16:18:33 2012 +0300 +++ b/tests/test-graft.t Tue Apr 10 12:49:12 2012 -0500 @@ -107,6 +107,14 @@ Graft out of order, skipping a merge and a duplicate + $ hg graft 1 5 4 3 'merge()' 2 -n + skipping ungraftable merge revision 6 + skipping already grafted revision 2 + grafting revision 1 + grafting revision 5 + grafting revision 4 + grafting revision 3 + $ hg graft 1 5 4 3 'merge()' 2 --debug skipping ungraftable merge revision 6 scanning for duplicate grafts