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

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

Changeset c08f68ca89ab

Parent 467bba3abf63

by David Golub

Changes to 4 files · Browse files at c08f68ca89ab Showing diff from parent 467bba3abf63 Diff from another changeset...

 
47
48
49
50
 
51
52
53
 
303
304
305
306
 
307
308
309
 
319
320
321
322
 
323
324
325
 
330
331
332
333
334
 
 
335
336
337
 
47
48
49
 
50
51
52
53
 
303
304
305
 
306
307
308
309
 
319
320
321
 
322
323
324
325
 
330
331
332
 
 
333
334
335
336
337
@@ -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
145
146
147
 
148
149
150
 
144
145
146
 
147
148
149
150
@@ -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
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
 
674
675
676
677
 
678
 
 
 
 
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
 
695
696
697
 
698
699
700
701
702
@@ -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)