comparison 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
comparison
equal deleted inserted replaced
23549:609ecde2778f 23550:7fa2189c1e87
1654 for f in match.files(): 1654 for f in match.files():
1655 ui.write(self._gitcommand(cmd + [f])) 1655 ui.write(self._gitcommand(cmd + [f]))
1656 elif match(gitprefix): #Subrepo is matched 1656 elif match(gitprefix): #Subrepo is matched
1657 ui.write(self._gitcommand(cmd)) 1657 ui.write(self._gitcommand(cmd))
1658 1658
1659 def revert(self, ui, substate, *pats, **opts):
1660 ui.status(_('reverting subrepo %s\n') % substate[0])
1661 if not opts.get('no_backup'):
1662 ui.warn('%s: reverting %s subrepos without '
1663 '--no-backup is unsupported\n'
1664 % (substate[0], substate[2]))
1665 return []
1666
1667 self.get(substate, overwrite=True)
1668 return []
1669
1659 def shortid(self, revid): 1670 def shortid(self, revid):
1660 return revid[:7] 1671 return revid[:7]
1661 1672
1662 types = { 1673 types = {
1663 'hg': hgsubrepo, 1674 'hg': hgsubrepo,