Changeset 09c52af4db50…
Parent 0589a0ce1741…
by
Changes to one file · Browse files at 09c52af4db50 Showing diff from parent 0589a0ce1741 Diff from another changeset...
@@ -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')),
|
Loading...