diff hgext/largefiles/overrides.py @ 24207:d90e3faf96a9

largefiles: don't prefix standin patterns with '.hglf' when logging When logging '.hglf/foo', the pattern list was being transformed from ['.hglf/foo'] into ['.hglf/foo', '.hglf/.hglf/foo']. Aside from the pathological case of somebody getting a directory named '.hglf' created inside the standing directory, the old code shouldn't have had any bad effects. (amended by mpm to sort patterns for test stability and not upset check-code)
author Matt Harbison <matt_harbison@yahoo.com>
date Sun, 01 Mar 2015 14:21:54 -0500
parents 13c1e66f9653
children e6b0de02a02e
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py	Sat Feb 28 23:42:38 2015 -0500
+++ b/hgext/largefiles/overrides.py	Sun Mar 01 14:21:54 2015 -0500
@@ -319,11 +319,21 @@
             back = (m._cwd.count('/') + 1) * '../'
 
             def tostandin(f):
+                # The file may already be a standin, so trucate the back
+                # escaping and test before mangling it.  This avoids turning
+                # 'glob:../.hglf/foo*' into 'glob:../.hglf/../.hglf/foo*'.
+                if f.startswith(back) and lfutil.splitstandin(f[len(back):]):
+                    return f
+
                 return back + lfutil.standin(m._cwd + '/' + f)
 
             pats.update(fixpats(f, tostandin) for f in p)
         else:
-            pats.update(fixpats(f) for f in p)
+            def tostandin(f):
+                if lfutil.splitstandin(f):
+                    return f
+                return lfutil.standin(f)
+            pats.update(fixpats(f, tostandin) for f in p)
 
         for i in range(0, len(m._files)):
             # Don't add '.hglf' to m.files, since that is already covered by '.'
@@ -351,6 +361,7 @@
             return r
         m.matchfn = lfmatchfn
 
+        ui.debug('updated patterns: %s\n' % sorted(pats))
         return m, pats
 
     # For hg log --patch, the match object is used in two different senses: