Patchwork [2,of,4] subrepo: use subrepo shortid method to generate subrepo diverged promptchoice

login
register
mail settings
Submitter Angel Ezquerra
Date May 7, 2014, 10:54 p.m.
Message ID <c1035596456a23347b3c.1399503296@Angel-PC.localdomain>
Download mbox | patch
Permalink /patch/4659/
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 1399414402 -7200
#      Wed May 07 00:13:22 2014 +0200
# Node ID c1035596456a23347b3cfb510bf7c62a68166b90
# Parent  99337cb12ccffe7283daaa1f117efb5d42211670
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.

Patch

diff -r 99337cb12ccf -r c1035596456a mercurial/subrepo.py
--- 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