Show More
@@ -15,6 +15,7 b' from mercurial.i18n import _' | |||||
15 |
|
15 | |||
16 | from mercurial import ( |
|
16 | from mercurial import ( | |
17 | error, |
|
17 | error, | |
|
18 | extensions, | |||
18 | localrepo, |
|
19 | localrepo, | |
19 | match as matchmod, |
|
20 | match as matchmod, | |
20 | scmutil, |
|
21 | scmutil, | |
@@ -47,45 +48,46 b' def reposetup(ui, repo):' | |||||
47 | ctx = super(lfilesrepo, self).__getitem__(changeid) |
|
48 | ctx = super(lfilesrepo, self).__getitem__(changeid) | |
48 | if self.lfstatus: |
|
49 | if self.lfstatus: | |
49 |
|
50 | |||
50 |
|
|
51 | def files(orig): | |
51 |
|
|
52 | filenames = orig() | |
52 | filenames = super(lfilesctx, self).files() |
|
53 | return [lfutil.splitstandin(f) or f for f in filenames] | |
53 | return [lfutil.splitstandin(f) or f for f in filenames] |
|
|||
54 |
|
54 | |||
55 | def manifest(self): |
|
55 | extensions.wrapfunction(ctx, 'files', files) | |
56 | man1 = super(lfilesctx, self).manifest() |
|
56 | ||
|
57 | def manifest(orig): | |||
|
58 | man1 = orig() | |||
57 |
|
59 | |||
58 |
|
|
60 | class lfilesmanifest(man1.__class__): | |
59 |
|
|
61 | def __contains__(self, filename): | |
60 |
|
|
62 | orig = super(lfilesmanifest, self).__contains__ | |
61 |
|
|
63 | return orig(filename) or orig( | |
62 |
|
|
64 | lfutil.standin(filename) | |
63 |
|
|
65 | ) | |
64 |
|
66 | |||
65 |
|
|
67 | man1.__class__ = lfilesmanifest | |
66 |
|
|
68 | return man1 | |
67 |
|
69 | |||
68 | def filectx(self, path, fileid=None, filelog=None): |
|
70 | extensions.wrapfunction(ctx, 'manifest', manifest) | |
69 | orig = super(lfilesctx, self).filectx |
|
|||
70 | try: |
|
|||
71 | if filelog is not None: |
|
|||
72 | result = orig(path, fileid, filelog) |
|
|||
73 | else: |
|
|||
74 | result = orig(path, fileid) |
|
|||
75 | except error.LookupError: |
|
|||
76 | # Adding a null character will cause Mercurial to |
|
|||
77 | # identify this as a binary file. |
|
|||
78 | if filelog is not None: |
|
|||
79 | result = orig( |
|
|||
80 | lfutil.standin(path), fileid, filelog |
|
|||
81 | ) |
|
|||
82 | else: |
|
|||
83 | result = orig(lfutil.standin(path), fileid) |
|
|||
84 | olddata = result.data |
|
|||
85 | result.data = lambda: olddata() + b'\0' |
|
|||
86 | return result |
|
|||
87 |
|
71 | |||
88 | ctx.__class__ = lfilesctx |
|
72 | def filectx(orig, path, fileid=None, filelog=None): | |
|
73 | try: | |||
|
74 | if filelog is not None: | |||
|
75 | result = orig(path, fileid, filelog) | |||
|
76 | else: | |||
|
77 | result = orig(path, fileid) | |||
|
78 | except error.LookupError: | |||
|
79 | # Adding a null character will cause Mercurial to | |||
|
80 | # identify this as a binary file. | |||
|
81 | if filelog is not None: | |||
|
82 | result = orig(lfutil.standin(path), fileid, filelog) | |||
|
83 | else: | |||
|
84 | result = orig(lfutil.standin(path), fileid) | |||
|
85 | olddata = result.data | |||
|
86 | result.data = lambda: olddata() + b'\0' | |||
|
87 | return result | |||
|
88 | ||||
|
89 | extensions.wrapfunction(ctx, 'filectx', filectx) | |||
|
90 | ||||
89 | return ctx |
|
91 | return ctx | |
90 |
|
92 | |||
91 | # Figure out the status of big files and insert them into the |
|
93 | # Figure out the status of big files and insert them into the |
General Comments 0
You need to be logged in to leave comments.
Login now