[PATCH 1 of 5] localrepo: change aftertrans to be independant of the store path

Benoit Boissinot benoit.boissinot at ens-lyon.org
Fri Dec 1 05:35:30 CST 2006


# HG changeset patch
# User Benoit Boissinot <benoit.boissinot at ens-lyon.org>
# Date 1164964807 -3600
# Node ID 5ba7c5033cabef68382b157c11324d15f397e44c
# Parent  98f2507c55510e6335f9cdd8e230c88a08d63e28
localrepo: change aftertrans to be independant of the store path

diff -r 98f2507c5551 -r 5ba7c5033cab mercurial/localrepo.py
--- a/mercurial/localrepo.py	Tue Nov 28 21:16:05 2006 +0100
+++ b/mercurial/localrepo.py	Fri Dec 01 10:20:07 2006 +0100
@@ -470,9 +470,11 @@ class localrepository(repo.repository):
             ds = ""
         self.opener("journal.dirstate", "w").write(ds)
 
+        renames = [(self.sjoin("journal"), self.sjoin("undo")),
+                   (self.join("journal.dirstate"), self.join("undo.dirstate"))]
         tr = transaction.transaction(self.ui.warn, self.sopener,
                                        self.sjoin("journal"),
-                                       aftertrans(self.path))
+                                       aftertrans(renames))
         self.transhandle = tr
         return tr
 
@@ -1882,12 +1884,11 @@ class localrepository(repo.repository):
         return self.pull(remote, heads)
 
 # used to avoid circular references so destructors work
-def aftertrans(base):
-    p = base
+def aftertrans(files):
+    renamefiles = [tuple(t) for t in files]
     def a():
-        util.rename(os.path.join(p, "journal"), os.path.join(p, "undo"))
-        util.rename(os.path.join(p, "journal.dirstate"),
-                    os.path.join(p, "undo.dirstate"))
+        for src, dest in renamefiles:
+            util.rename(src, dest)
     return a
 
 def instance(ui, path, create):


More information about the Mercurial-devel mailing list