diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py index b8a5643f04..2eb58e446d 100644 --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -1910,7 +1910,7 @@ class gitsubrepo(abstractsubrepo): status = self.status(None) names = status.modified for name in names: - bakname = "%s.orig" % name + bakname = cmdutil.origpath(self.ui, self._subparent, name) self.ui.note(_('saving current version of %s as %s\n') % (name, bakname)) self.wvfs.rename(name, bakname) diff --git a/tests/test-subrepo-git.t b/tests/test-subrepo-git.t index dcd3402e46..0161efe6ae 100644 --- a/tests/test-subrepo-git.t +++ b/tests/test-subrepo-git.t @@ -875,6 +875,16 @@ revert the subrepository $ hg status --subrepos ? s/barfoo +revert moves orig files to the right place + $ echo 'bloop' > s/foobar + $ hg revert --all --verbose --config 'ui.origbackuppath=.hg/origbackups' + reverting subrepo ../gitroot + creating directory: $TESTTMP/tc/.hg/origbackups + saving current version of foobar as $TESTTMP/tc/.hg/origbackups/foobar.orig + $ ls .hg/origbackups + foobar.orig + $ rm -rf .hg/origbackups + show file at specific revision $ cat > s/foobar << EOF > woop woop