[PATCH] use repo.wjoin(f) instead of os.path.join(repo.root, f)

Martin Geisler mg at daimi.au.dk
Fri Jan 2 15:53:53 CST 2009


# HG changeset patch
# User Martin Geisler <mg at daimi.au.dk>
# Date 1230933213 -3600
# Node ID 7cbd31c6c9d6a8e5bf1fff9fd68d39e02c11ab95
# Parent  4949729ee9ee5f1e22d1212c557bed3ecc6ff5d3
use repo.wjoin(f) instead of os.path.join(repo.root, f)

diff --git a/hgext/extdiff.py b/hgext/extdiff.py
--- a/hgext/extdiff.py
+++ b/hgext/extdiff.py
@@ -80,9 +80,7 @@
     '''snapshot files from working directory.
     if not using snapshot, -I/-X does not work and recursive diff
     in tools like kdiff3 and meld displays too many files.'''
-    repo_root = repo.root
-
-    dirname = os.path.basename(repo_root)
+    dirname = os.path.basename(repo.root)
     if dirname == "":
         dirname = "root"
     base = os.path.join(tmproot, dirname)
@@ -105,8 +103,7 @@
             fp.write(chunk)
         fp.close()
 
-        fns_and_mtime.append((dest, os.path.join(repo_root, fn),
-            os.path.getmtime(dest)))
+        fns_and_mtime.append((dest, repo.wjoin(fn), os.path.getmtime(dest)))
 
 
     return dirname, fns_and_mtime
diff --git a/hgext/purge.py b/hgext/purge.py
--- a/hgext/purge.py
+++ b/hgext/purge.py
@@ -64,7 +64,7 @@
     def remove(remove_func, name):
         if act:
             try:
-                remove_func(os.path.join(repo.root, name))
+                remove_func(repo.wjoin(name))
             except OSError:
                 m = _('%s cannot be removed') % name
                 if opts['abort_on_err']:
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1797,7 +1797,7 @@
         if not rev and abs not in repo.dirstate:
             continue
         if opts.get('fullpath'):
-            ui.write(os.path.join(repo.root, abs), end)
+            ui.write(repo.wjoin(abs), end)
         else:
             ui.write(((pats and m.rel(abs)) or abs), end)
         ret = 0
diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -1057,7 +1057,7 @@
         gp = patches[f]
         if gp and gp.mode:
             islink, isexec = gp.mode
-            dst = os.path.join(repo.root, gp.path)
+            dst = repo.wjoin(gp.path)
             # patch won't create empty files
             if gp.op == 'ADD' and not os.path.exists(dst):
                 flags = (isexec and 'x' or '') + (islink and 'l' or '')


More information about the Mercurial-devel mailing list