diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -1656,6 +1656,17 @@ class gitsubrepo(abstractsubrepo): elif match(gitprefix): #Subrepo is matched ui.write(self._gitcommand(cmd)) + def revert(self, ui, substate, *pats, **opts): + ui.status(_('reverting subrepo %s\n') % substate[0]) + if not opts.get('no_backup'): + ui.warn('%s: reverting %s subrepos without ' + '--no-backup is unsupported\n' + % (substate[0], substate[2])) + return [] + + self.get(substate, overwrite=True) + return [] + def shortid(self, revid): return revid[:7] diff --git a/tests/test-subrepo-git.t b/tests/test-subrepo-git.t --- a/tests/test-subrepo-git.t +++ b/tests/test-subrepo-git.t @@ -784,4 +784,21 @@ ensure adding include/exclude ignores th $ hg diff --subrepos -I s/foobar $ hg diff --subrepos -X s/foobar +revert the subrepository + $ hg revert --all + reverting subrepo ../gitroot (glob) + ../gitroot: reverting git subrepos without --no-backup is unsupported (glob) + + $ hg status --subrepos + M s/foobar + A s/barfoo + + $ hg revert --no-backup --all + reverting subrepo ../gitroot (glob) + $ hg revert --no-backup s + reverting subrepo ../gitroot (glob) + + $ hg status --subrepos + ? s/barfoo + $ cd ..