Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in tip

fogcreek thgrepo, filedata, filelistmodel, manifestmodel: add support for largefiles

Changeset 41e53eb631e3

Parent 79bd48afc681

by David Golub

Changes to 4 files · Browse files at 41e53eb631e3 Showing diff from parent 79bd48afc681 Diff from another changeset...

 
48
49
50
51
 
52
53
54
 
304
305
306
307
 
308
309
310
 
320
321
322
323
 
324
325
326
 
331
332
333
334
335
 
 
336
337
338
 
48
49
50
 
51
52
53
54
 
304
305
306
 
307
308
309
310
 
320
321
322
 
323
324
325
326
 
331
332
333
 
 
334
335
336
337
338
@@ -48,7 +48,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: @@ -304,7 +304,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: @@ -320,7 +320,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() @@ -331,8 +331,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:
 
146
147
148
149
 
150
151
152
 
146
147
148
 
149
150
151
152
@@ -146,7 +146,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
253
254
255
 
256
257
258
 
252
253
254
 
255
256
257
258
@@ -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
27
28
 
29
30
31
 
537
538
539
540
541
 
 
 
 
 
 
 
 
542
543
544
 
 
 
 
545
546
547
548
 
549
 
 
 
550
551
552
 
615
616
617
618
619
 
 
 
 
 
 
 
 
620
621
622
 
 
623
624
625
 
 
626
627
628
629
 
 
 
 
 
 
630
631
632
 
26
27
28
29
30
31
32
 
538
539
540
 
 
541
542
543
544
545
546
547
548
549
 
 
550
551
552
553
554
555
556
 
557
558
559
560
561
562
563
564
 
627
628
629
 
 
630
631
632
633
634
635
636
637
638
 
 
639
640
641
 
 
642
643
644
 
 
 
645
646
647
648
649
650
651
652
653
@@ -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 = {}