identity: show trailing '+' for dirty subrepos (issue2839) stable
authorPatrick Mezard <patrick@mezard.eu>
Fri, 27 Jul 2012 13:56:19 +0200
branchstable
changeset 17255 3e856d8abe9c
parent 17254 0deb66d4ad81
child 17256 707cbbf950ea
child 17261 c0068b058fcd
identity: show trailing '+' for dirty subrepos (issue2839)
mercurial/commands.py
tests/test-subrepo-git.t
tests/test-subrepo-svn.t
tests/test-subrepo.t
--- a/mercurial/commands.py	Fri Jul 27 10:16:20 2012 +0200
+++ b/mercurial/commands.py	Fri Jul 27 13:56:19 2012 +0200
@@ -3506,7 +3506,9 @@
             parents = ctx.parents()
             changed = ""
             if default or id or num:
-                changed = util.any(repo.status()) and "+" or ""
+                if (util.any(repo.status())
+                    or util.any(ctx.sub(s).dirty() for s in ctx.substate)):
+                    changed = '+'
             if default or id:
                 output = ["%s%s" %
                   ('+'.join([hexfunc(p.node()) for p in parents]), changed)]
--- a/tests/test-subrepo-git.t	Fri Jul 27 10:16:20 2012 +0200
+++ b/tests/test-subrepo-git.t	Fri Jul 27 13:56:19 2012 +0200
@@ -430,7 +430,7 @@
   $ git add f1
   $ cd ..
   $ hg id -n
-  1
+  1+
   $ cd s
   $ git rev-parse HEAD
   da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
@@ -487,7 +487,7 @@
    l
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg id -n
-  7
+  7+
   $ cd s
   $ git rev-parse HEAD
   aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
--- a/tests/test-subrepo-svn.t	Fri Jul 27 10:16:20 2012 +0200
+++ b/tests/test-subrepo-svn.t	Fri Jul 27 13:56:19 2012 +0200
@@ -313,7 +313,7 @@
   A         f1
   $ cd ..
   $ hg id -n
-  1
+  1+
   $ cd s
   $ svnversion
   2M
@@ -376,7 +376,7 @@
    l
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg id -n
-  2
+  2+
   $ cd s
   $ svnversion
   1M
--- a/tests/test-subrepo.t	Fri Jul 27 10:16:20 2012 +0200
+++ b/tests/test-subrepo.t	Fri Jul 27 13:56:19 2012 +0200
@@ -112,10 +112,16 @@
   abort: uncommitted changes in subrepo s
   (use --subrepos for recursive commit)
   [255]
+  $ hg id
+  f6affe3fbfaa+ tip
+  $ hg -R s ci -mc
+  $ hg id
+  f6affe3fbfaa+ tip
+  $ echo d > s/a
   $ hg ci -m4
   committing subrepository s
   $ hg tip -R s
-  changeset:   3:1c833a7a9e3a
+  changeset:   4:02dcf1d70411
   tag:         tip
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
@@ -135,7 +141,7 @@
   $ hg debugsub
   path s
    source   s
-   revision 1c833a7a9e3a4445c711aaf0f012379cd0d4034e
+   revision 02dcf1d704118aee3ee306ccfa1910850d5b05ef
 
 new branch for merge tests
 
@@ -741,7 +747,7 @@
   $ hg add -S s/f1
   $ hg add -S t/f1
   $ hg id
-  365661e5936a
+  365661e5936a+
   $ hg -R s id
   fc627a69481f+
   $ hg -R t id  
@@ -785,7 +791,7 @@
   $ hg id
   e45c8b14af55+
   $ hg -R s id
-  1c833a7a9e3a
+  02dcf1d70411
   $ hg -R t id  
   7af322bc1198
 
@@ -797,21 +803,21 @@
   $ hg id
   e45c8b14af55+
   $ hg -R s id
-  1c833a7a9e3a+
+  02dcf1d70411+
   $ hg -R t id  
   7af322bc1198+
   $ hg update tip
    subrepository sources for s differ
-  use (l)ocal source (1c833a7a9e3a) or (r)emote source (12a213df6fa9)?
+  use (l)ocal source (02dcf1d70411) or (r)emote source (12a213df6fa9)?
    l
    subrepository sources for t differ
   use (l)ocal source (7af322bc1198) or (r)emote source (52c0adc0515a)?
    l
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg id
-  925c17564ef8 tip
+  925c17564ef8+ tip
   $ hg -R s id
-  1c833a7a9e3a+
+  02dcf1d70411+
   $ hg -R t id  
   7af322bc1198+