Changeset c08f68ca89ab…
Parent 467bba3abf63…
by
Changes to 4 files · Browse files at c08f68ca89ab Showing diff from parent 467bba3abf63 Diff from another changeset...
@@ -47,7 +47,7 @@ return None
try:
data = fctx.data()
- if '\0' in data or ctx.isKbf(wfile):
+ if '\0' in data or ctx.isStandin(wfile):
self.error = p + _('File is binary.\n')
return None
except (EnvironmentError, util.Abort), e:
@@ -303,7 +303,7 @@ else:
self.contents = olddata
self.flabel += _(' <i>(was deleted)</i>')
- elif hasattr(ctx.p1(), 'hasBfile') and ctx.p1().hasBfile(wfile):
+ elif hasattr(ctx.p1(), 'hasStandin') and ctx.p1().hasStandin(wfile):
self.error = 'binary file'
self.flabel += _(' <i>(was deleted)</i>')
else:
@@ -319,7 +319,7 @@ return
else:
data = util.posixfile(absfile, 'r').read()
- elif ctx.hasBfile(wfile):
+ elif ctx.hasStandin(wfile):
data = '\0'
else:
data = ctx.filectx(wfile).data()
@@ -330,8 +330,8 @@ return
if status in ('M', 'A'):
- if ctx.hasBfile(wfile):
- wfile = ctx.standin(wfile)
+ if ctx.hasStandin(wfile):
+ wfile = ctx.findStandin(wfile)
isbfile = True
res = self.checkMaxDiff(ctx, wfile, maxdiff)
if res is None:
|
@@ -144,7 +144,7 @@ for lst, flag in ((added, 'A'), (modified, 'M'), (removed, 'R')):
for f in filter(func, lst):
wasmerged = ismerge and f in ctxfiles
- f = self._ctx.removeKbf(f)
+ f = self._ctx.removeStandin(f)
files.append({'path': f, 'status': flag, 'parent': parent,
'wasmerged': wasmerged})
return files
|
@@ -252,7 +252,7 @@ continue
origpath = path
- path = self._repo.removeKbf(path)
+ path = self._repo.removeStandin(path)
e = treeroot
for p in hglib.tounicode(path).split('/'):
|
@@ -26,6 +26,7 @@
_repocache = {}
_kbfregex = re.compile(r'^\.kbf/')
+_lfregex = re.compile(r'^\.hglf/')
if 'THGDEBUG' in os.environ:
def dbgoutput(*args):
@@ -537,16 +538,27 @@ dest = tempfile.mktemp(ext+'.bak', root+'_', trashcan)
shutil.copyfile(path, dest)
- def isKbf(self, path):
- return 'kbfiles' in self.extensions() and _kbfregex.match(path)
+ def isStandin(self, path):
+ if 'largefiles' in self.extensions():
+ if _lfregex.match(path):
+ return True
+ if 'largefiles' in self.extensions() or 'kbfiles' in self.extensions():
+ if _kbfregex.match(path):
+ return True
+ return False
- def removeKbf(self, path):
- if 'kbfiles' in self.extensions():
+ def removeStandin(self, path):
+ if 'largefiles' in self.extensions():
+ path = _lfregex.sub('', path)
+ if 'largefiles' in self.extensions() or 'kbfiles' in self.extensions():
path = _kbfregex.sub('', path)
return path
- def standin(self, path):
+ def bfStandin(self, path):
return '.kbf/' + path
+
+ def lfStandin(self, path):
+ return '.hglf/' + path
return thgrepository
@@ -615,18 +627,27 @@
return summary
- def hasBfile(self, file):
- return 'kbfiles' in self._repo.extensions() and self._repo.standin(file) in self.manifest()
+ def hasStandin(self, file):
+ if 'largefiles' in self._repo.extensions():
+ if self._repo.lfStandin(file) in self.manifest():
+ return True
+ elif 'largefiles' in self._repo.extensions() or 'kbfiles' in self._repo.extensions():
+ if self._repo.bfStandin(file) in self.manifest():
+ return True
+ return False
- def isKbf(self, path):
- return self._repo.isKbf(path)
+ def isStandin(self, path):
+ return self._repo.isStandin(path)
- def removeKbf(self, path):
- return self._repo.removeKbf(path)
+ def removeStandin(self, path):
+ return self._repo.removeStandin(path)
- def standin(self, path):
- return self._repo.standin(path)
-
+ def findStandin(self, file):
+ if 'largefiles' in self._repo.extensions():
+ if self._repo.lfStandin(file) in self.manifest():
+ return self._repo.lfStandin(file)
+ return self._repo.bfStandin(file)
+
return thgchangectx
_pctxcache = {}
@@ -674,5 +695,8 @@ else:
f.close()
-def isKbf(path):
+def isBfStandin(path):
return _kbfregex.match(path)
+
+def isLfStandin(path):
+ return _lfregex.match(path)
|
Loading...