##// END OF EJS Templates
merge: pass mergeresult obj instead of actions in _checkcollision() (API)...
Pulkit Goyal -
r45893:f569ca3e default
parent child Browse files
Show More
@@ -288,7 +288,7 b' def _forgetremoved(wctx, mctx, branchmer'
288 return actions
288 return actions
289
289
290
290
291 def _checkcollision(repo, wmf, actions):
291 def _checkcollision(repo, wmf, mresult):
292 """
292 """
293 Check for case-folding collisions.
293 Check for case-folding collisions.
294 """
294 """
@@ -296,39 +296,40 b' def _checkcollision(repo, wmf, actions):'
296 narrowmatch = repo.narrowmatch()
296 narrowmatch = repo.narrowmatch()
297 if not narrowmatch.always():
297 if not narrowmatch.always():
298 pmmf = set(wmf.walk(narrowmatch))
298 pmmf = set(wmf.walk(narrowmatch))
299 if actions:
299 if mresult:
300 narrowactions = {}
300 for f, actionsfortype in pycompat.iteritems(mresult.actions):
301 for m, actionsfortype in pycompat.iteritems(actions):
301 if not narrowmatch(f):
302 narrowactions[m] = []
302 mresult.removefile(f)
303 for (f, args, msg) in actionsfortype:
304 if narrowmatch(f):
305 narrowactions[m].append((f, args, msg))
306 actions = narrowactions
307 else:
303 else:
308 # build provisional merged manifest up
304 # build provisional merged manifest up
309 pmmf = set(wmf)
305 pmmf = set(wmf)
310
306
311 if actions:
307 if mresult:
312 # KEEP and EXEC are no-op
308 # KEEP and EXEC are no-op
313 for m in (
309 for f, args, msg in mresult.getactions(
314 mergestatemod.ACTION_ADD,
310 (
315 mergestatemod.ACTION_ADD_MODIFIED,
311 mergestatemod.ACTION_ADD,
316 mergestatemod.ACTION_FORGET,
312 mergestatemod.ACTION_ADD_MODIFIED,
317 mergestatemod.ACTION_GET,
313 mergestatemod.ACTION_FORGET,
318 mergestatemod.ACTION_CHANGED_DELETED,
314 mergestatemod.ACTION_GET,
319 mergestatemod.ACTION_DELETED_CHANGED,
315 mergestatemod.ACTION_CHANGED_DELETED,
316 mergestatemod.ACTION_DELETED_CHANGED,
317 )
320 ):
318 ):
321 for f, args, msg in actions[m]:
319 pmmf.add(f)
322 pmmf.add(f)
320 for f, args, msg in mresult.getactions([mergestatemod.ACTION_REMOVE]):
323 for f, args, msg in actions[mergestatemod.ACTION_REMOVE]:
324 pmmf.discard(f)
321 pmmf.discard(f)
325 for f, args, msg in actions[mergestatemod.ACTION_DIR_RENAME_MOVE_LOCAL]:
322 for f, args, msg in mresult.getactions(
323 [mergestatemod.ACTION_DIR_RENAME_MOVE_LOCAL]
324 ):
326 f2, flags = args
325 f2, flags = args
327 pmmf.discard(f2)
326 pmmf.discard(f2)
328 pmmf.add(f)
327 pmmf.add(f)
329 for f, args, msg in actions[mergestatemod.ACTION_LOCAL_DIR_RENAME_GET]:
328 for f, args, msg in mresult.getactions(
329 [mergestatemod.ACTION_LOCAL_DIR_RENAME_GET]
330 ):
330 pmmf.add(f)
331 pmmf.add(f)
331 for f, args, msg in actions[mergestatemod.ACTION_MERGE]:
332 for f, args, msg in mresult.getactions([mergestatemod.ACTION_MERGE]):
332 f1, f2, fa, move, anc = args
333 f1, f2, fa, move, anc = args
333 if move:
334 if move:
334 pmmf.discard(f1)
335 pmmf.discard(f1)
@@ -1960,9 +1961,6 b' def update('
1960 else:
1961 else:
1961 mresult.removefile(f)
1962 mresult.removefile(f)
1962
1963
1963 # Convert to dictionary-of-lists format
1964 actions = mresult.actionsdict
1965
1966 if not util.fscasesensitive(repo.path):
1964 if not util.fscasesensitive(repo.path):
1967 # check collision between files only in p2 for clean update
1965 # check collision between files only in p2 for clean update
1968 if not branchmerge and (
1966 if not branchmerge and (
@@ -1970,7 +1968,7 b' def update('
1970 ):
1968 ):
1971 _checkcollision(repo, p2.manifest(), None)
1969 _checkcollision(repo, p2.manifest(), None)
1972 else:
1970 else:
1973 _checkcollision(repo, wc.manifest(), actions)
1971 _checkcollision(repo, wc.manifest(), mresult)
1974
1972
1975 # divergent renames
1973 # divergent renames
1976 for f, fl in sorted(pycompat.iteritems(mresult.diverge)):
1974 for f, fl in sorted(pycompat.iteritems(mresult.diverge)):
@@ -2008,6 +2006,9 b' def update('
2008 # note that we're in the middle of an update
2006 # note that we're in the middle of an update
2009 repo.vfs.write(b'updatestate', p2.hex())
2007 repo.vfs.write(b'updatestate', p2.hex())
2010
2008
2009 # Convert to dictionary-of-lists format
2010 actions = mresult.actionsdict
2011
2011 _advertisefsmonitor(
2012 _advertisefsmonitor(
2012 repo, len(actions[mergestatemod.ACTION_GET]), p1.node()
2013 repo, len(actions[mergestatemod.ACTION_GET]), p1.node()
2013 )
2014 )
General Comments 0
You need to be logged in to leave comments. Login now