[PATCH 3 of 9 RFC] normfn: normalize paths to filelog in global style

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Fri May 25 10:00:52 CDT 2012


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1337957587 -32400
# Node ID 4a676979c48890516e28b82505d64f8fe9c710bd
# Parent  a9aa18f59d106b4607cc74cc13b5eaf734a5bef8
normfn: normalize paths to filelog in global style

For portability of repository itself, paths to filelog should be
normalized in "global style".

diff -r a9aa18f59d10 -r 4a676979c488 hgext/keyword.py
--- a/hgext/keyword.py	Fri May 25 23:53:07 2012 +0900
+++ b/hgext/keyword.py	Fri May 25 23:53:07 2012 +0900
@@ -565,6 +565,9 @@
         def file(self, f):
             if f[0] == '/':
                 f = f[1:]
+            fnfromlocal = getattr(self, 'fnfromlocal', None)
+            if fnfromlocal:
+                f = fnfromlocal(f)
             return kwfilelog(self.sopener, kwt, f)
 
         def wread(self, filename):
diff -r a9aa18f59d10 -r 4a676979c488 mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py	Fri May 25 23:53:07 2012 +0900
+++ b/mercurial/bundlerepo.py	Fri May 25 23:53:07 2012 +0900
@@ -260,6 +260,9 @@
 
         if f[0] == '/':
             f = f[1:]
+        fnfromlocal = getattr(self, 'fnfromlocal', None)
+        if fnfromlocal:
+            f = fnfromlocal(f)
         if f in self.bundlefilespos:
             self.bundle.seek(self.bundlefilespos[f])
             return bundlefilelog(self.sopener, f, self.bundle,
diff -r a9aa18f59d10 -r 4a676979c488 mercurial/localrepo.py
--- a/mercurial/localrepo.py	Fri May 25 23:53:07 2012 +0900
+++ b/mercurial/localrepo.py	Fri May 25 23:53:07 2012 +0900
@@ -633,6 +633,9 @@
     def file(self, f):
         if f[0] == '/':
             f = f[1:]
+        fnfromlocal = getattr(self, 'fnfromlocal', None)
+        if fnfromlocal:
+            f = fnfromlocal(f)
         return filelog.filelog(self.sopener, f)
 
     def changectx(self, changeid):


More information about the Mercurial-devel mailing list