changeset 15265:460135339d74

revert: warn that subrepos cannot be reverted (tests added by mpm)
author Angel Ezquerra <angel.ezquerra@gmail.com>
date Sat, 15 Oct 2011 01:06:52 +0200
parents 157d93c41c10
children 8bea39ca9acb
files mercurial/commands.py tests/test-subrepo.t
diffstat 2 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Wed Oct 12 21:45:58 2011 -0400
+++ b/mercurial/commands.py	Sat Oct 15 01:06:52 2011 +0200
@@ -4652,6 +4652,10 @@
         def badfn(path, msg):
             if path in names:
                 return
+            if path in repo[node].substate:
+                ui.warn("%s: %s\n" % (m.rel(path),
+                    'reverting subrepos is unsupported'))
+                return
             path_ = path + '/'
             for f in names:
                 if f.startswith(path_):
--- a/tests/test-subrepo.t	Wed Oct 12 21:45:58 2011 -0400
+++ b/tests/test-subrepo.t	Sat Oct 15 01:06:52 2011 +0200
@@ -34,6 +34,18 @@
   $ hg ci -m1
   committing subrepository s
 
+Revert can't (yet) revert subrepos:
+
+  $ echo b > s/a
+  $ hg revert s
+  s: reverting subrepos is unsupported
+
+Revert currently ignores subrepos by default
+
+  $ hg revert -a
+  $ hg revert -R s -a -C
+  reverting s/a
+
 Issue2022: update -C
 
   $ echo b > s/a