Patchwork [4,of,4] subrepo: show detailed revision info for the divergent subrepo revisions

login
register
mail settings
Submitter Angel Ezquerra
Date May 7, 2014, 10:54 p.m.
Message ID <dd02d8d8c7d244755e98.1399503298@Angel-PC.localdomain>
Download mbox | patch
Permalink /patch/4660/
State Superseded
Headers show

Comments

Angel Ezquerra - May 7, 2014, 10:54 p.m.
# HG changeset patch
# User Angel Ezquerra <angel.ezquerra@gmail.com>
# Date 1399415105 -7200
#      Wed May 07 00:25:05 2014 +0200
# Node ID dd02d8d8c7d244755e98c4b656b6eefedd668b98
# Parent  874013facd42bd2a8bbd07634cad02448709c5ac
subrepo: show detailed revision info for the divergent subrepo revisions

Up until now it was very hard to decide what to do when mercurial showed a
"subrepo diverged" prompt. We were only showing the revision id, but this is
hardly enough information to decide what to do.

Now we show the revision details for the local and remote so that the user can
take a better decision.
Matt Mackall - May 16, 2014, 11:16 p.m.
On Thu, 2014-05-08 at 00:54 +0200, Angel Ezquerra wrote:
> # HG changeset patch
> # User Angel Ezquerra <angel.ezquerra@gmail.com>
> # Date 1399415105 -7200
> #      Wed May 07 00:25:05 2014 +0200
> # Node ID dd02d8d8c7d244755e98c4b656b6eefedd668b98
> # Parent  874013facd42bd2a8bbd07634cad02448709c5ac
> subrepo: show detailed revision info for the divergent subrepo revisions

>     subrepository sub diverged (local revision: b2fdb12cd82b, remote revision: aa037b301eba)
> +  subrepository sub local revision details:
> +  changeset:   0:b2fdb12cd82b
> +  user:        test
> +  date:        Thu Jan 01 00:00:00 1970 +0000
> +  summary:     0sub
> +  
> +  subrepository sub remote revision details:
> +  changeset:   1:aa037b301eba
> +  tags:        tip
> +  user:        test
> +  date:        Thu Jan 01 00:00:00 1970 +0000
> +  summary:     foo
> +  
>    (M)erge, keep (l)ocal or keep (r)emote? m

I'm afraid I'm not keen on this.

First, it's WAY more verbose than any other prompt, but perhaps not
verbose enough to actually accomplish its purpose. I will often probably
still need to go investigate the subrepo DAG if I'm in doubt.

Second, I could do that before this patch anyway: just open another
terminal, cd into the subrepo, and ask about the revisions.

But more importantly, my plan for merge prompts is "no more". There are
a bunch of merge decisions that are really hard to deal with via prompts
(like case collisions) and rather than try to deal with them via
prompts, I want to instead say "hey, we hit this merge problem, see
resolve". As part of this, I want to allow deferring all the existing
prompts to resolve as well so that they can be retried or manually
resolved. So this is moving in the wrong direction: try to do more with
prompts.
Matt Mackall - June 24, 2014, 6:44 p.m.
On Sat, 2014-05-17 at 23:15 +0200, Angel Ezquerra wrote:
> > Second, I could do that before this patch anyway: just open another
> > terminal, cd into the subrepo, and ask about the revisions.
> 
> When you are using the command line it is possible to do as you say.
> However, when using TortoiseHg that is not so easy. We convert
> mercurial's prompts into modal dialogs.

..and this is exactly where my sympathy for your plight ends. I can't
let the UI design problems of a GUI app dictate how our command line
interface works.

Prompts are the command line's equivalent of modal dialogs. Modal
dialogs suck; prompts suck. The direction forward is making them go
away, not making them more elaborate.

Patch

diff -r 874013facd42 -r dd02d8d8c7d2 mercurial/subrepo.py
--- a/mercurial/subrepo.py	Wed May 07 00:17:22 2014 +0200
+++ b/mercurial/subrepo.py	Wed May 07 00:25:05 2014 +0200
@@ -209,9 +209,15 @@ 
                 option = repo.ui.promptchoice(
                     _(' subrepository %s diverged (local revision: %s, '
                       'remote revision: %s)\n'
+                      'subrepository %s local revision details:\n%s\n'
+                      'subrepository %s remote revision details:\n%s\n'
                       '(M)erge, keep (l)ocal or keep (r)emote?'
                       '$$ &Merge $$ &Local $$ &Remote')
-                    % (s, srepo.shortid(l[1]), srepo.shortid(r[1])), 0)
+                    % (s,
+                       srepo.shortid(l[1]),
+                       srepo.shortid(r[1]),
+                       s, srepo.revdetails(l[1]),
+                       s, srepo.revdetails(r[1])), 0)
                 if option == 0:
                     wctx.sub(s).merge(r)
                     sm[s] = l
diff -r 874013facd42 -r dd02d8d8c7d2 tests/test-mq-subrepo.t
--- a/tests/test-mq-subrepo.t	Wed May 07 00:17:22 2014 +0200
+++ b/tests/test-mq-subrepo.t	Wed May 07 00:25:05 2014 +0200
@@ -264,6 +264,19 @@ 
   $ hg qpush
   applying 1.diff
    subrepository sub diverged (local revision: b2fdb12cd82b, remote revision: aa037b301eba)
+  subrepository sub local revision details:
+  changeset:   0:b2fdb12cd82b
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     0sub
+  
+  subrepository sub remote revision details:
+  changeset:   1:aa037b301eba
+  tags:        tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     foo
+  
   (M)erge, keep (l)ocal or keep (r)emote? m
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   now at: 1.diff
diff -r 874013facd42 -r dd02d8d8c7d2 tests/test-subrepo-git.t
--- a/tests/test-subrepo-git.t	Wed May 07 00:17:22 2014 +0200
+++ b/tests/test-subrepo-git.t	Wed May 07 00:25:05 2014 +0200
@@ -156,6 +156,12 @@ 
   (run 'hg heads' to see heads, 'hg merge' to merge)
   $ hg merge 2>/dev/null
    subrepository s diverged (local revision: 796959400868, remote revision: aa84837ccfbd)
+  subrepository s local revision details:
+  changeset:   79695940086840c99328513acbe35f90fcd55e57
+  
+  subrepository s remote revision details:
+  changeset:   aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
+  
   (M)erge, keep (l)ocal or keep (r)emote? m
   pulling subrepo s from $TESTTMP/gitroot
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -465,6 +471,12 @@ 
   $ cd ..
   $ hg update 4
    subrepository s diverged (local revision: da5f5b1d8ffc, remote revision: aa84837ccfbd)
+  subrepository s local revision details:
+  changeset:   da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
+  
+  subrepository s remote revision details:
+  changeset:   aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
+  
   (M)erge, keep (l)ocal or keep (r)emote? m
    subrepository sources for s differ
   use (l)ocal source (da5f5b1) or (r)emote source (aa84837)?
@@ -492,6 +504,12 @@ 
   $ cd ..
   $ hg update 1
    subrepository s diverged (local revision: 32a343883b74, remote revision: da5f5b1d8ffc)
+  subrepository s local revision details:
+  changeset:   32a343883b74769118bb1d3b4b1fbf9156f4dddc
+  
+  subrepository s remote revision details:
+  changeset:   da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
+  
   (M)erge, keep (l)ocal or keep (r)emote? m
    subrepository sources for s differ (in checked out version)
   use (l)ocal source (32a3438) or (r)emote source (da5f5b1)?
@@ -515,6 +533,12 @@ 
   1+
   $ hg update 7
    subrepository s diverged (local revision: 32a343883b74, remote revision: 32a343883b74)
+  subrepository s local revision details:
+  changeset:   32a343883b74769118bb1d3b4b1fbf9156f4dddc
+  
+  subrepository s remote revision details:
+  changeset:   32a343883b74769118bb1d3b4b1fbf9156f4dddc
+  
   (M)erge, keep (l)ocal or keep (r)emote? m
    subrepository sources for s differ
   use (l)ocal source (32a3438) or (r)emote source (32a3438)?
diff -r 874013facd42 -r dd02d8d8c7d2 tests/test-subrepo-svn.t
--- a/tests/test-subrepo-svn.t	Wed May 07 00:17:22 2014 +0200
+++ b/tests/test-subrepo-svn.t	Wed May 07 00:25:05 2014 +0200
@@ -320,6 +320,12 @@ 
   $ cd ..
   $ hg update tip
    subrepository s diverged (local revision: 2, remote revision: 3)
+  subrepository s local revision details:
+  changeset:   2
+  
+  subrepository s remote revision details:
+  changeset:   3
+  
   (M)erge, keep (l)ocal or keep (r)emote? m
    subrepository sources for s differ
   use (l)ocal source (2) or (r)emote source (3)?
@@ -352,6 +358,12 @@ 
   $ cd ..
   $ hg update 1
    subrepository s diverged (local revision: 3, remote revision: 2)
+  subrepository s local revision details:
+  changeset:   3
+  
+  subrepository s remote revision details:
+  changeset:   2
+  
   (M)erge, keep (l)ocal or keep (r)emote? m
    subrepository sources for s differ (in checked out version)
   use (l)ocal source (1) or (r)emote source (2)?
@@ -376,6 +388,12 @@ 
   1+
   $ hg update tip
    subrepository s diverged (local revision: 3, remote revision: 3)
+  subrepository s local revision details:
+  changeset:   3
+  
+  subrepository s remote revision details:
+  changeset:   3
+  
   (M)erge, keep (l)ocal or keep (r)emote? m
    subrepository sources for s differ
   use (l)ocal source (1) or (r)emote source (3)?
@@ -411,6 +429,12 @@ 
   $ cd ..
   $ hg update 1
    subrepository s diverged (local revision: 3, remote revision: 2)
+  subrepository s local revision details:
+  changeset:   3
+  
+  subrepository s remote revision details:
+  changeset:   2
+  
   (M)erge, keep (l)ocal or keep (r)emote? m
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg id -n
diff -r 874013facd42 -r dd02d8d8c7d2 tests/test-subrepo.t
--- a/tests/test-subrepo.t	Wed May 07 00:17:22 2014 +0200
+++ b/tests/test-subrepo.t	Wed May 07 00:25:05 2014 +0200
@@ -275,6 +275,19 @@ 
   subrepo merge e45c8b14af55+ f94576341bcf 1831e14459c4
     subrepo t: both sides changed 
    subrepository t diverged (local revision: 20a0db6fbf6c, remote revision: 7af322bc1198)
+  subrepository t local revision details:
+  changeset:   3:20a0db6fbf6c
+  tags:        tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     10
+  
+  subrepository t remote revision details:
+  changeset:   2:7af322bc1198
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     7
+  
   (M)erge, keep (l)ocal or keep (r)emote? m
   merging subrepo t
     searching for copies back to rev 2
@@ -657,6 +670,20 @@ 
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg merge 4    # try to merge default into br again
    subrepository s diverged (local revision: f8f13b33206e, remote revision: a3f9062a4f88)
+  subrepository s local revision details:
+  changeset:   5:f8f13b33206e
+  branch       br
+  tags:        tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     1
+  
+  subrepository s remote revision details:
+  changeset:   4:a3f9062a4f88
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     1
+  
   (M)erge, keep (l)ocal or keep (r)emote? m
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
@@ -974,11 +1001,37 @@ 
   e95bcfa18a35+
   $ hg update tip
    subrepository s diverged (local revision: fc627a69481f, remote revision: 12a213df6fa9)
+  subrepository s local revision details:
+  changeset:   2:fc627a69481f
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     s1
+  
+  subrepository s remote revision details:
+  changeset:   5:12a213df6fa9
+  tags:        tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     12
+  
   (M)erge, keep (l)ocal or keep (r)emote? m
    subrepository sources for s differ
   use (l)ocal source (fc627a69481f) or (r)emote source (12a213df6fa9)?
    l
    subrepository t diverged (local revision: e95bcfa18a35, remote revision: 52c0adc0515a)
+  subrepository t local revision details:
+  changeset:   4:e95bcfa18a35
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     11
+  
+  subrepository t remote revision details:
+  changeset:   5:52c0adc0515a
+  tags:        tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     13
+  
   (M)erge, keep (l)ocal or keep (r)emote? m
    subrepository sources for t differ
   use (l)ocal source (e95bcfa18a35) or (r)emote source (52c0adc0515a)?
@@ -1009,8 +1062,34 @@ 
   $ cd ..
   $ hg update 10
    subrepository s diverged (local revision: 12a213df6fa9, remote revision: fc627a69481f)
+  subrepository s local revision details:
+  changeset:   5:12a213df6fa9
+  tags:        tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     12
+  
+  subrepository s remote revision details:
+  changeset:   2:fc627a69481f
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     s1
+  
   (M)erge, keep (l)ocal or keep (r)emote? m
    subrepository t diverged (local revision: 52c0adc0515a, remote revision: 20a0db6fbf6c)
+  subrepository t local revision details:
+  changeset:   5:52c0adc0515a
+  tags:        tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     13
+  
+  subrepository t remote revision details:
+  changeset:   3:20a0db6fbf6c
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     10
+  
   (M)erge, keep (l)ocal or keep (r)emote? m
    subrepository sources for t differ (in checked out version)
   use (l)ocal source (7af322bc1198) or (r)emote source (20a0db6fbf6c)?
@@ -1036,11 +1115,39 @@ 
   7af322bc1198+
   $ hg update tip
    subrepository s diverged (local revision: 12a213df6fa9, remote revision: 12a213df6fa9)
+  subrepository s local revision details:
+  changeset:   5:12a213df6fa9
+  tags:        tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     12
+  
+  subrepository s remote revision details:
+  changeset:   5:12a213df6fa9
+  tags:        tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     12
+  
   (M)erge, keep (l)ocal or keep (r)emote? m
    subrepository sources for s differ
   use (l)ocal source (02dcf1d70411) or (r)emote source (12a213df6fa9)?
    l
    subrepository t diverged (local revision: 52c0adc0515a, remote revision: 52c0adc0515a)
+  subrepository t local revision details:
+  changeset:   5:52c0adc0515a
+  tags:        tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     13
+  
+  subrepository t remote revision details:
+  changeset:   5:52c0adc0515a
+  tags:        tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     13
+  
   (M)erge, keep (l)ocal or keep (r)emote? m
    subrepository sources for t differ
   use (l)ocal source (7af322bc1198) or (r)emote source (52c0adc0515a)?
@@ -1070,6 +1177,19 @@ 
   $ cd ..
   $ hg update 11
    subrepository s diverged (local revision: 12a213df6fa9, remote revision: fc627a69481f)
+  subrepository s local revision details:
+  changeset:   5:12a213df6fa9
+  tags:        tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     12
+  
+  subrepository s remote revision details:
+  changeset:   2:fc627a69481f
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     s1
+  
   (M)erge, keep (l)ocal or keep (r)emote? m
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved