Patchwork [2,of,3] graft: improve --continue abort message

login
register
mail settings
Submitter timeless@mozdev.org
Date Dec. 2, 2015, 6:35 a.m.
Message ID <4d20fad83e4bce745f53.1449038108@waste.org>
Download mbox | patch
Permalink /patch/11733/
State Accepted
Headers show

Comments

timeless@mozdev.org - Dec. 2, 2015, 6:35 a.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1449038032 0
#      Wed Dec 02 06:33:52 2015 +0000
# Node ID 4d20fad83e4bce745f53d837a8199c2ef5b7eb9d
# Parent  a227e8b8b5b0b180a04b2ca76a0823fe136d44b5
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...
Augie Fackler - Dec. 2, 2015, 3:16 p.m.
On Wed, Dec 02, 2015 at 12:35:08AM -0600, timeless wrote:
> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1449038032 0
> #      Wed Dec 02 06:33:52 2015 +0000
> # Node ID 4d20fad83e4bce745f53d837a8199c2ef5b7eb9d
> # Parent  a227e8b8b5b0b180a04b2ca76a0823fe136d44b5
> graft: improve --continue abort message

queued these, thanks!

>
> 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...
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -3786,9 +3786,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
>
> diff --git a/tests/test-graft.t b/tests/test-graft.t
> --- a/tests/test-graft.t
> +++ b/tests/test-graft.t
> @@ -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:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3786,9 +3786,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
 
diff --git a/tests/test-graft.t b/tests/test-graft.t
--- a/tests/test-graft.t
+++ b/tests/test-graft.t
@@ -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: