Mercurial > public > mercurial-scm > hg-stable
diff mercurial/subrepo.py @ 23550:7fa2189c1e87
subrepo: add revert support without backup for git subrepos
Previously, git subrepos did not support reverting.
This change adds basic support for reverting
when '--no-backup' is specified.
A warning is given (and the current state is kept)
when a revert is done without the '--no-backup' flag.
author | Mathias De Mar? <mathias.demare@gmail.com> |
---|---|
date | Sun, 14 Dec 2014 11:34:51 +0100 |
parents | f274d27f1994 |
children | 9626120e017b |
line wrap: on
line diff
--- a/mercurial/subrepo.py Sat Nov 01 22:56:49 2014 -0700 +++ b/mercurial/subrepo.py Sun Dec 14 11:34:51 2014 +0100 @@ -1656,6 +1656,17 @@ 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]