Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.1, 2.1.1, and 2.1.2

manifest: show contents of subrepo files

Changeset 6b23790bd518

Parent 29e80a63dfd4

by Angel Ezquerra

Changes to 2 files · Browse files at 6b23790bd518 Showing diff from parent 29e80a63dfd4 Diff from another changeset...

 
27
28
29
30
 
31
32
33
 
41
42
43
44
 
45
46
47
 
85
86
87
88
 
 
 
 
 
 
 
 
 
 
 
 
89
90
91
 
265
266
267
268
 
269
270
271
 
27
28
29
 
30
31
32
33
 
41
42
43
 
44
45
46
47
 
85
86
87
 
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
 
276
277
278
 
279
280
281
282
@@ -27,7 +27,7 @@
  except (EnvironmentError, error.LookupError), e:   self.error = hglib.tounicode(str(e))   - def checkMaxDiff(self, ctx, wfile): + def checkMaxDiff(self, ctx, wfile, maxdiff=None):   p = _('File or diffs not displayed: ')   try:   fctx = ctx.filectx(wfile) @@ -41,7 +41,7 @@
  except (EnvironmentError, error.LookupError), e:   self.error = p + hglib.tounicode(str(e))   return None - if size > ctx._repo.maxdiff: + if size > maxdiff:   self.error = p + _('File is larger than the specified max size.\n')   return None   try: @@ -85,7 +85,18 @@
  self.flabel += _(' <i>(is a symlink)</i>')   return   - absfile = repo.wjoin(wfile) + wsub, wfileinsub, sctx = \ + hglib.getDeepestSubrepoContainingFile(wfile, ctx) + if wsub: + topctx = ctx + topwfile = wfile + ctx = sctx + wfile = wfileinsub + else: + topctx = ctx + topwfile = wfile + + absfile = repo.wjoin(os.path.join(wsub or '',wfile))   if (wfile in ctx and 'l' in ctx.flags(wfile)) or \   os.path.islink(absfile):   if wfile in ctx: @@ -265,7 +276,7 @@
  return     if status in ('M', 'A'): - res = self.checkMaxDiff(ctx, wfile) + res = self.checkMaxDiff(ctx, wfile, repo.maxdiff)   if res is None:   return   fctx, newdata = res
 
559
560
561
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
@@ -559,3 +559,28 @@
  except AttributeError:   from mercurial import patch   return patch.export(repo, revs, template, fp, switch_parent, opts) + +def getDeepestSubrepoContainingFile(wfile, ctx): + """ + Given a filename and context, get the deepest subrepo that contains the file + + Also return the corresponding subrepo context and the filename relative to + its containing subrepo + """ + if wfile in ctx.files(): + return '', wfile, ctx + for wsub in ctx.substate.keys(): + if wfile.startswith(wsub): + srev = ctx.substate[wsub][1] + sctx = ctx.sub(wsub)._repo[srev] + wfileinsub = wfile[len(wsub)+1:] + if wfileinsub in sctx.files(): + return wsub, wfileinsub, sctx + else: + wsubsub, wfileinsub, sctx = \ + getDeepestSubrepoContainingFile(wfileinsub, sctx) + if wsubsub is None: + return None, wfile, ctx + else: + return os.path.join(wsub, wsubsub), wfileinsub, sctx + return None, wfile, ctx