diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -904,17 +904,15 @@ class localrepository(object): self.destroying() transaction.rollback(self.sopener, self.sjoin('undo'), ui.warn) if self.vfs.exists('undo.bookmarks'): - util.rename(self.join('undo.bookmarks'), - self.join('bookmarks')) + self.vfs.rename('undo.bookmarks', 'bookmarks') if self.svfs.exists('undo.phaseroots'): - util.rename(self.sjoin('undo.phaseroots'), - self.sjoin('phaseroots')) + self.svfs.rename('undo.phaseroots', 'phaseroots') self.invalidate() parentgone = (parents[0] not in self.changelog.nodemap or parents[1] not in self.changelog.nodemap) if parentgone: - util.rename(self.join('undo.dirstate'), self.join('dirstate')) + self.vfs.rename('undo.dirstate', 'dirstate') try: branch = self.opener.read('undo.branch') self.dirstate.setbranch(encoding.tolocal(branch)) diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -254,6 +254,9 @@ class abstractvfs(object): def readdir(self, path=None, stat=None, skip=None): return osutil.listdir(self.join(path), stat, skip) + def rename(self, src, dst): + return util.rename(self.join(src), self.join(dst)) + def stat(self, path=None): return os.stat(self.join(path))