changeset 18943:27e8dfc2c338

subrepo: fix exception on revert when "all" option is omitted Since fafdff7e9c43, backout does not set opts['all'], which causes KeyError at hgsubrepo.revert.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 15 Apr 2013 23:52:57 +0900
parents 6891e361bec6
children a9c443b3b240
files mercurial/subrepo.py tests/test-subrepo.t
diffstat 2 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/subrepo.py	Sun Apr 14 19:05:19 2013 -0500
+++ b/mercurial/subrepo.py	Mon Apr 15 23:52:57 2013 +0900
@@ -764,7 +764,7 @@
             opts['rev'] = substate[1]
 
             pats = []
-            if not opts['all']:
+            if not opts.get('all'):
                 pats = ['set:modified()']
             self.filerevert(ui, *pats, **opts)
 
@@ -774,7 +774,7 @@
     def filerevert(self, ui, *pats, **opts):
         ctx = self._repo[opts['rev']]
         parents = self._repo.dirstate.parents()
-        if opts['all']:
+        if opts.get('all'):
             pats = ['set:modified()']
         else:
             pats = []
--- a/tests/test-subrepo.t	Sun Apr 14 19:05:19 2013 -0500
+++ b/tests/test-subrepo.t	Mon Apr 15 23:52:57 2013 +0900
@@ -461,6 +461,20 @@
   $ hg ci -m13
   committing subrepository t
 
+backout calls revert internally with minimal opts, which should not raise
+KeyError
+
+  $ hg backout ".^"
+  reverting .hgsubstate
+  reverting subrepo s
+  reverting s/a
+  reverting subrepo ss
+  reverting subrepo t
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg up -C # discard changes
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
 pull
 
   $ cd ../tc