Kiln » largefiles » largefiles-kiln-truncated changes meant to be shipped in Kiln Extensions to aid migration path to Mercurial-bundled largefiles
Clone URL:  

Properly handle hg log -v, etc. when bfiles are in use. This should fix bug 2083751.

Changeset 09c52af4db50

Parent 0589a0ce1741

by David Golub

Changes to one file · Browse files at 09c52af4db50 Showing diff from parent 0589a0ce1741 Diff from another changeset...

 
3
4
5
 
6
7
8
 
55
56
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
59
60
 
541
542
543
 
 
 
 
 
544
545
546
 
1208
1209
1210
 
1211
1212
1213
 
3
4
5
6
7
8
9
 
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
 
562
563
564
565
566
567
568
569
570
571
572
 
1234
1235
1236
1237
1238
1239
1240
@@ -3,6 +3,7 @@
 import os  import types  import copy +import re    from mercurial import hg, extensions, commands, util, context, cmdutil, \   match as match_, filemerge, node, archival, httprepo, error @@ -55,6 +56,26 @@
  def status_nobfiles(self, *args, **kwargs):   return super(bfiles_repo, self).status(*args, **kwargs)   + # When bfstatus is set, return a context that gives the names of bfiles + # instead of their corresponding standins and identifies the bfiles as + # always binary, regardless of their actual contents. + def __getitem__(self, changeid): + ctx = super(bfiles_repo, self).__getitem__(changeid) + if self.bfstatus: + class bfiles_ctx(ctx.__class__): + def files(self): + filenames = super(bfiles_ctx, self).files() + return [re.sub(r'^\.kbf/', '', filename) for filename in filenames] + def filectx(self, path, fileid=None, filelog=None): + try: + result = super(bfiles_ctx, self).filectx(path, fileid, filelog) + except: + result = super(bfiles_ctx, self).filectx('.kbf/' + path, fileid, filelog) + result.data = lambda: '\0' + return result + ctx.__class__ = bfiles_ctx + return ctx +   # Figure out the status of big files and insert them into the   # appropriate list in the result. Also removes standin files from   # the listing. This function reverts to the original status if @@ -541,6 +562,11 @@
  finally:   repo.bfstatus = False   +def override_log(orig, ui, repo, *pats, **opts): + repo.bfstatus = True + orig(ui, repo, *pats, **opts) + repo.bfstatus = False +  def override_verify(orig, ui, repo, *pats, **opts):   bf = opts.pop('bf', False)   all = opts.pop('bfa', False) @@ -1208,6 +1234,7 @@
  entry = extensions.wrapcommand(commands.table, 'remove', override_remove)   entry = extensions.wrapcommand(commands.table, 'forget', override_forget)   entry = extensions.wrapcommand(commands.table, 'status', override_status) + entry = extensions.wrapcommand(commands.table, 'log', override_log)     entry = extensions.wrapcommand(commands.table, 'verify', override_verify)   verifyopt = [('', 'bf', None, _('verify bfiles')),