Details
Details
- Reviewers
pulkit - Group Reviewers
hg-reviewers - Commits
- rHGa02e4c12ae60: largefiles: allow "lfstatus" context manager to set value to False
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
( )
| pulkit |
| hg-reviewers |
| Lint Skipped |
| Unit Tests Skipped |
| Path | Packages | |||
|---|---|---|---|---|
| M | hgext/largefiles/lfutil.py (10 lines) |
| Commit | Parents | Author | Summary | Date |
|---|---|---|---|---|
| bddcc8c56357 | 1f21803644cb | Martin von Zweigbergk | Oct 18 2019, 8:52 PM |
| Status | Author | Revision | |
|---|---|---|---|
| Abandoned | martinvonz | ||
| Abandoned | martinvonz | ||
| Abandoned | martinvonz | ||
| Abandoned | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz |
| shortname = b'.hglf' | shortname = b'.hglf' | ||||
| shortnameslash = shortname + b'/' | shortnameslash = shortname + b'/' | ||||
| longname = b'largefiles' | longname = b'largefiles' | ||||
| # -- Private worker functions ------------------------------------------ | # -- Private worker functions ------------------------------------------ | ||||
| @contextlib.contextmanager | @contextlib.contextmanager | ||||
| def lfstatus(repo): | def lfstatus(repo, value=True): | ||||
| oldvalue = getattr(repo, 'lfstatus', False) | oldvalue = getattr(repo, 'lfstatus', False) | ||||
| repo.lfstatus = True | repo.lfstatus = value | ||||
| try: | try: | ||||
| yield | yield | ||||
| finally: | finally: | ||||
| repo.lfstatus = oldvalue | repo.lfstatus = oldvalue | ||||
| def getminsize(ui, assumelfiles, opt, default=10): | def getminsize(ui, assumelfiles, opt, default=10): | ||||
| lfsize = opt | lfsize = opt | ||||
| _(b'finding outgoing largefiles'), | _(b'finding outgoing largefiles'), | ||||
| unit=_(b'revisions'), | unit=_(b'revisions'), | ||||
| total=len(missing), | total=len(missing), | ||||
| ) as progress: | ) as progress: | ||||
| for i, n in enumerate(missing): | for i, n in enumerate(missing): | ||||
| progress.update(i) | progress.update(i) | ||||
| parents = [p for p in repo[n].parents() if p != node.nullid] | parents = [p for p in repo[n].parents() if p != node.nullid] | ||||
| oldlfstatus = repo.lfstatus | with lfstatus(repo, value=False): | ||||
| repo.lfstatus = False | |||||
| try: | |||||
| ctx = repo[n] | ctx = repo[n] | ||||
| finally: | |||||
| repo.lfstatus = oldlfstatus | |||||
| files = set(ctx.files()) | files = set(ctx.files()) | ||||
| if len(parents) == 2: | if len(parents) == 2: | ||||
| mc = ctx.manifest() | mc = ctx.manifest() | ||||
| mp1 = ctx.p1().manifest() | mp1 = ctx.p1().manifest() | ||||
| mp2 = ctx.p2().manifest() | mp2 = ctx.p2().manifest() | ||||
| for f in mp1: | for f in mp1: | ||||
| if f not in mc: | if f not in mc: | ||||