equal
deleted
inserted
replaced
7 # GNU General Public License version 2 or any later version. |
7 # GNU General Public License version 2 or any later version. |
8 |
8 |
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 |
15 import stat |
16 import stat |
16 |
17 |
35 shortname = b'.hglf' |
36 shortname = b'.hglf' |
36 shortnameslash = shortname + b'/' |
37 shortnameslash = shortname + b'/' |
37 longname = b'largefiles' |
38 longname = b'largefiles' |
38 |
39 |
39 # -- Private worker functions ------------------------------------------ |
40 # -- Private worker functions ------------------------------------------ |
|
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 |
40 |
51 |
41 |
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: |