comparison hgext/absorb.py @ 38918:2ac40e86f604

absorb: avoid mutable default arg Differential Revision: https://phab.mercurial-scm.org/D4043
author Augie Fackler <augie@google.com>
date Wed, 01 Aug 2018 18:23:28 -0400
parents 5111d11b8719
children dc4750b2a04e
comparison
equal deleted inserted replaced
38917:5111d11b8719 38918:2ac40e86f604
124 result.append(ctx) 124 result.append(ctx)
125 ctx = parents[0] 125 ctx = parents[0]
126 result.reverse() 126 result.reverse()
127 return result 127 return result
128 128
129 def getfilestack(stack, path, seenfctxs=set()): 129 def getfilestack(stack, path, seenfctxs=None):
130 """([ctx], str, set) -> [fctx], {ctx: fctx} 130 """([ctx], str, set) -> [fctx], {ctx: fctx}
131 131
132 stack is a list of contexts, from old to new. usually they are what 132 stack is a list of contexts, from old to new. usually they are what
133 "getdraftstack" returns. 133 "getdraftstack" returns.
134 134
161 - if stack = [2], returns ([], {}) 161 - if stack = [2], returns ([], {})
162 - if stack = [7], returns ([1, 2], {7: 2}) 162 - if stack = [7], returns ([1, 2], {7: 2})
163 - if stack = [6, 7], returns ([1, 2], {6: 1, 7: 2}), although {6: 1} can be 163 - if stack = [6, 7], returns ([1, 2], {6: 1, 7: 2}), although {6: 1} can be
164 removed, since 1 is immutable. 164 removed, since 1 is immutable.
165 """ 165 """
166 if seenfctxs is None:
167 seenfctxs = set()
166 assert stack 168 assert stack
167 169
168 if path not in stack[-1]: 170 if path not in stack[-1]:
169 return [], {} 171 return [], {}
170 172