hgext/largefiles/overrides.py
changeset 24207 d90e3faf96a9
parent 24206 13c1e66f9653
child 24208 e6b0de02a02e
--- 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: