subrepo: use subrepo shortid method to generate subrepo diverged promptchoice
We were always using only the first 12 characters of the subrepo revision id
when generating the "subrepo diverged" promptchoice. This is not necessarily
correct for non mercurial subrepos.
--- a/mercurial/subrepo.py Wed May 07 00:08:20 2014 +0200
+++ b/mercurial/subrepo.py Wed May 07 00:13:22 2014 +0200
@@ -205,12 +205,13 @@
sm[s] = r
else:
debug(s, "both sides changed")
+ srepo = wctx.sub(s)
option = repo.ui.promptchoice(
_(' subrepository %s diverged (local revision: %s, '
'remote revision: %s)\n'
'(M)erge, keep (l)ocal or keep (r)emote?'
'$$ &Merge $$ &Local $$ &Remote')
- % (s, l[1][:12], r[1][:12]), 0)
+ % (s, srepo.shortid(l[1]), srepo.shortid(r[1])), 0)
if option == 0:
wctx.sub(s).merge(r)
sm[s] = l
--- a/tests/test-subrepo-git.t Wed May 07 00:08:20 2014 +0200
+++ b/tests/test-subrepo-git.t Wed May 07 00:13:22 2014 +0200
@@ -155,7 +155,7 @@
added 1 changesets with 1 changes to 1 files (+1 heads)
(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 diverged (local revision: 7969594, remote revision: aa84837)
(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
@@ -464,7 +464,7 @@
da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
$ cd ..
$ hg update 4
- subrepository s diverged (local revision: da5f5b1d8ffc, remote revision: aa84837ccfbd)
+ subrepository s diverged (local revision: da5f5b1, remote revision: aa84837)
(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)?
@@ -491,7 +491,7 @@
HEAD is now at aa84837... f
$ cd ..
$ hg update 1
- subrepository s diverged (local revision: 32a343883b74, remote revision: da5f5b1d8ffc)
+ subrepository s diverged (local revision: 32a3438, remote revision: da5f5b1)
(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)?
@@ -514,7 +514,7 @@
$ hg id -n
1+
$ hg update 7
- subrepository s diverged (local revision: 32a343883b74, remote revision: 32a343883b74)
+ subrepository s diverged (local revision: 32a3438, remote revision: 32a3438)
(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)?