graft: improve --continue abort message
authortimeless <timeless@mozdev.org>
Wed, 02 Dec 2015 06:33:52 +0000
changeset 27173 8a8f5d71a49a
parent 27172 4d61c847e06c
child 27174 9fbe3545e4bd
graft: improve --continue abort message before, if you ran hg graft --user ... --date ... --log ... revs, and if it failed, it would suggest "hg graft --continue", but if you did that, your --user / --date / --log options were lost, because they were not persisted anywhere...
mercurial/commands.py
tests/test-graft.t
--- a/mercurial/commands.py	Wed Dec 02 06:31:12 2015 +0000
+++ b/mercurial/commands.py	Wed Dec 02 06:33:52 2015 +0000
@@ -3867,9 +3867,17 @@
                     # write out state for --continue
                     nodelines = [repo[rev].hex() + "\n" for rev in revs[pos:]]
                     repo.vfs.write('graftstate', ''.join(nodelines))
+                    extra = ''
+                    if opts.get('user'):
+                        extra += ' --user %s' % opts['user']
+                    if opts.get('date'):
+                        extra += ' --date %s' % opts['date']
+                    if opts.get('log'):
+                        extra += ' --log'
+                    hint=_('use hg resolve and hg graft --continue%s') % extra
                     raise error.Abort(
                         _("unresolved conflicts, can't continue"),
-                        hint=_('use hg resolve and hg graft --continue'))
+                        hint=hint)
             else:
                 cont = False
 
--- a/tests/test-graft.t	Wed Dec 02 06:31:12 2015 +0000
+++ b/tests/test-graft.t	Wed Dec 02 06:33:52 2015 +0000
@@ -138,7 +138,7 @@
   grafting 4:9c233e8e184d "4"
   grafting 3:4c60f11aa304 "3"
 
-  $ HGEDITOR=cat hg graft 1 5 4 3 'merge()' 2 --debug
+  $ HGEDITOR=cat hg graft 1 5 'merge()' 2 --debug
   skipping ungraftable merge revision 6
   scanning for duplicate grafts
   skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
@@ -174,6 +174,8 @@
   e
   committing manifest
   committing changelog
+  $ HGEDITOR=cat hg graft 4 3 --log --debug
+  scanning for duplicate grafts
   grafting 4:9c233e8e184d "4"
     searching for copies back to rev 1
   resolving manifests
@@ -192,7 +194,7 @@
   my e@1905859650ec+ other e@9c233e8e184d ancestor e@68795b066622
   warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
   abort: unresolved conflicts, can't continue
-  (use hg resolve and hg graft --continue)
+  (use hg resolve and hg graft --continue --log)
   [255]
 
 Summary should mention graft: