Details
Details
- Reviewers
indygreg - Group Reviewers
hg-reviewers - Commits
- rHG2ac40e86f604: absorb: avoid mutable default arg
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
( )
| indygreg |
| hg-reviewers |
| Lint Skipped |
| Unit Tests Skipped |
| Path | Packages | |||
|---|---|---|---|---|
| M | hgext/absorb.py (4 lines) |
| Commit | Parents | Author | Summary | Date |
|---|---|---|---|---|
| Augie Fackler | Aug 1 2018, 6:23 PM |
| parents = ctx.parents() | parents = ctx.parents() | ||||
| if len(parents) != 1: | if len(parents) != 1: | ||||
| break | break | ||||
| result.append(ctx) | result.append(ctx) | ||||
| ctx = parents[0] | ctx = parents[0] | ||||
| result.reverse() | result.reverse() | ||||
| return result | return result | ||||
| def getfilestack(stack, path, seenfctxs=set()): | def getfilestack(stack, path, seenfctxs=None): | ||||
| """([ctx], str, set) -> [fctx], {ctx: fctx} | """([ctx], str, set) -> [fctx], {ctx: fctx} | ||||
| stack is a list of contexts, from old to new. usually they are what | stack is a list of contexts, from old to new. usually they are what | ||||
| "getdraftstack" returns. | "getdraftstack" returns. | ||||
| follows renames, but not copies. | follows renames, but not copies. | ||||
| seenfctxs is a set of filecontexts that will be considered "immutable". | seenfctxs is a set of filecontexts that will be considered "immutable". | ||||
| - if stack = [5, 6, 7], returns ([0, 1, 2], {5: 1, 6: 1, 7: 2}) | - if stack = [5, 6, 7], returns ([0, 1, 2], {5: 1, 6: 1, 7: 2}) | ||||
| - if stack = [3, 4, 5], returns ([e, 0, 1], {4: 0, 5: 1}), where "e" is a | - if stack = [3, 4, 5], returns ([e, 0, 1], {4: 0, 5: 1}), where "e" is a | ||||
| dummy empty filecontext. | dummy empty filecontext. | ||||
| - if stack = [2], returns ([], {}) | - if stack = [2], returns ([], {}) | ||||
| - if stack = [7], returns ([1, 2], {7: 2}) | - if stack = [7], returns ([1, 2], {7: 2}) | ||||
| - if stack = [6, 7], returns ([1, 2], {6: 1, 7: 2}), although {6: 1} can be | - if stack = [6, 7], returns ([1, 2], {6: 1, 7: 2}), although {6: 1} can be | ||||
| removed, since 1 is immutable. | removed, since 1 is immutable. | ||||
| """ | """ | ||||
| if seenfctxs is None: | |||||
| seenfctxs = set() | |||||
| assert stack | assert stack | ||||
| if path not in stack[-1]: | if path not in stack[-1]: | ||||
| return [], {} | return [], {} | ||||
| fctxs = [] | fctxs = [] | ||||
| fctxmap = {} | fctxmap = {} | ||||