[PATCH] subrepo: use posixpath when diffing, for consistent paths

Bryan O'Sullivan bos at serpentine.com
Tue Nov 27 16:58:29 CST 2012


# HG changeset patch
# User Bryan O'Sullivan <bryano at fb.com>
# Date 1354057080 28800
# Node ID a9f4a60767408bb1e29c5f7c3c7c6e06b96d585b
# Parent  0e2850a6fcdd9b28359941f099f04f635b97af27
subrepo: use posixpath when diffing, for consistent paths

This fixes a Windows failure in test-subrepo-recursion.t introduced
by c84ef0047a94.

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -6,7 +6,7 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-import cStringIO, email.Parser, os, errno, re
+import cStringIO, email.Parser, os, errno, re, posixpath
 import tempfile, zlib, shutil
 
 from i18n import _
@@ -1655,7 +1655,7 @@ def trydiff(repo, revs, ctx1, ctx2, modi
             copy, getfilectx, opts, losedatafn, prefix):
 
     def join(f):
-        return os.path.join(prefix, f)
+        return posixpath.join(prefix, f)
 
     def addmodehdr(header, omode, nmode):
         if omode != nmode:
diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -446,7 +446,7 @@ class hgsubrepo(abstractsubrepo):
                 node2 = node.bin(node2)
             cmdutil.diffordiffstat(self._repo.ui, self._repo, diffopts,
                                    node1, node2, match,
-                                   prefix=os.path.join(prefix, self._path),
+                                   prefix=posixpath.join(prefix, self._path),
                                    listsubrepos=True, **opts)
         except error.RepoLookupError, inst:
             self._repo.ui.warn(_('warning: error "%s" in subrepository "%s"\n')


More information about the Mercurial-devel mailing list