# HG changeset patch # User Yuya Nishihara # Date 1366037577 -32400 # Node ID 27e8dfc2c33868b49c9e6b2c2d8279ce92558592 # Parent 6891e361bec6831ada94b7c2b49950769aba7be9 subrepo: fix exception on revert when "all" option is omitted Since fafdff7e9c43, backout does not set opts['all'], which causes KeyError at hgsubrepo.revert. diff -r 6891e361bec6 -r 27e8dfc2c338 mercurial/subrepo.py --- 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 = [] diff -r 6891e361bec6 -r 27e8dfc2c338 tests/test-subrepo.t --- 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