##// END OF EJS Templates
largefiles: move lfstatus context manager to lfutil...
Martin von Zweigbergk -
r43982:73e6d334 default
parent child Browse files
Show More
@@ -9,6 +9,7 b''
9 '''largefiles utility code: must not import other modules in this package.'''
9 '''largefiles utility code: must not import other modules in this package.'''
10 from __future__ import absolute_import
10 from __future__ import absolute_import
11
11
12 import contextlib
12 import copy
13 import copy
13 import hashlib
14 import hashlib
14 import os
15 import os
@@ -39,6 +40,16 b" longname = b'largefiles'"
39 # -- Private worker functions ------------------------------------------
40 # -- Private worker functions ------------------------------------------
40
41
41
42
43 @contextlib.contextmanager
44 def lfstatus(repo):
45 oldvalue = getattr(repo, 'lfstatus', False)
46 repo.lfstatus = True
47 try:
48 yield
49 finally:
50 repo.lfstatus = oldvalue
51
52
42 def getminsize(ui, assumelfiles, opt, default=10):
53 def getminsize(ui, assumelfiles, opt, default=10):
43 lfsize = opt
54 lfsize = opt
44 if not lfsize and assumelfiles:
55 if not lfsize and assumelfiles:
@@ -9,7 +9,6 b''
9 '''Overridden Mercurial commands and functions for the largefiles extension'''
9 '''Overridden Mercurial commands and functions for the largefiles extension'''
10 from __future__ import absolute_import
10 from __future__ import absolute_import
11
11
12 import contextlib
13 import copy
12 import copy
14 import os
13 import os
15
14
@@ -50,6 +49,8 b' from . import ('
50
49
51 eh = exthelper.exthelper()
50 eh = exthelper.exthelper()
52
51
52 lfstatus = lfutil.lfstatus
53
53 # -- Utility functions: commonly/repeatedly needed functionality ---------------
54 # -- Utility functions: commonly/repeatedly needed functionality ---------------
54
55
55
56
@@ -158,16 +159,6 b' def addlargefiles(ui, repo, isaddremove,'
158 return added, bad
159 return added, bad
159
160
160
161
161 @contextlib.contextmanager
162 def lfstatus(repo):
163 oldvalue = getattr(repo, 'lfstatus', False)
164 repo.lfstatus = True
165 try:
166 yield
167 finally:
168 repo.lfstatus = oldvalue
169
170
171 def removelargefiles(ui, repo, isaddremove, matcher, uipathfn, dryrun, **opts):
162 def removelargefiles(ui, repo, isaddremove, matcher, uipathfn, dryrun, **opts):
172 after = opts.get('after')
163 after = opts.get('after')
173 m = composelargefilematcher(matcher, repo[None].manifest())
164 m = composelargefilematcher(matcher, repo[None].manifest())
General Comments 0
You need to be logged in to leave comments. Login now