Mercurial > public > mercurial-scm > hg
comparison mercurial/subrepo.py @ 23678:194d2f185008
subrepo: add full revert support for git subrepos
Previously, revert was only possible if the '--no-backup'
switch was specified.
Now, to support backups, we explicitly go over all modified
files in the subrepo.
author | Mathias De Mar? <mathias.demare@gmail.com> |
---|---|
date | Sun, 28 Dec 2014 10:42:25 +0100 |
parents | 965788d9ae09 |
children | dd1e73c4be13 |
comparison
equal
deleted
inserted
replaced
23677:6bc1702e7333 | 23678:194d2f185008 |
---|---|
1656 ui.write(self._gitcommand(cmd)) | 1656 ui.write(self._gitcommand(cmd)) |
1657 | 1657 |
1658 def revert(self, substate, *pats, **opts): | 1658 def revert(self, substate, *pats, **opts): |
1659 self.ui.status(_('reverting subrepo %s\n') % substate[0]) | 1659 self.ui.status(_('reverting subrepo %s\n') % substate[0]) |
1660 if not opts.get('no_backup'): | 1660 if not opts.get('no_backup'): |
1661 self.ui.warn('%s: reverting %s subrepos without ' | 1661 status = self.status(None) |
1662 '--no-backup is unsupported\n' | 1662 names = status.modified |
1663 % (substate[0], substate[2])) | 1663 for name in names: |
1664 return [] | 1664 bakname = "%s.orig" % name |
1665 self.ui.note(_('saving current version of %s as %s\n') % | |
1666 (name, bakname)) | |
1667 util.rename(os.path.join(self._abspath, name), | |
1668 os.path.join(self._abspath, bakname)) | |
1665 | 1669 |
1666 self.get(substate, overwrite=True) | 1670 self.get(substate, overwrite=True) |
1667 return [] | 1671 return [] |
1668 | 1672 |
1669 def shortid(self, revid): | 1673 def shortid(self, revid): |