comparison mercurial/merge.py @ 18541:5ed6a375e9ca

merge: delay debug messages for merge actions Show messages at a point where the actions have been sorted, thus preparing for backout of 760c0d67ce5e. This makes manifestmerge more of a silent operation, just like 'copies' is. Indent 'preserving' messages to make them subordinate to the action logging so they fit in the new context. (The 'preserving' messages are quite redundant and could also be removed completely.)
author Mads Kiilerich <madski@unity3d.com>
date Thu, 24 Jan 2013 23:57:44 +0100
parents 139529b0a191
children 46be5c9dac91
comparison
equal deleted inserted replaced
18540:139529b0a191 18541:5ed6a375e9ca
174 174
175 actions = [] 175 actions = []
176 state = branchmerge and 'r' or 'f' 176 state = branchmerge and 'r' or 'f'
177 for f in wctx.deleted(): 177 for f in wctx.deleted():
178 if f not in mctx: 178 if f not in mctx:
179 actions.append((f, state, None)) 179 actions.append((f, state, None, "forget deleted"))
180 180
181 if not branchmerge: 181 if not branchmerge:
182 for f in wctx.removed(): 182 for f in wctx.removed():
183 if f not in mctx: 183 if f not in mctx:
184 actions.append((f, "f", None)) 184 actions.append((f, "f", None, "forget removed"))
185 185
186 return actions 186 return actions
187 187
188 def manifestmerge(repo, p1, p2, pa, overwrite, partial): 188 def manifestmerge(repo, p1, p2, pa, overwrite, partial):
189 """ 189 """
192 overwrite = whether we clobber working files 192 overwrite = whether we clobber working files
193 partial = function to filter file lists 193 partial = function to filter file lists
194 """ 194 """
195 195
196 def act(msg, m, f, *args): 196 def act(msg, m, f, *args):
197 repo.ui.debug(" %s: %s -> %s\n" % (f, msg, m)) 197 actions.append((f, m, args, msg))
198 actions.append((f, m, args))
199 198
200 actions, copy, movewithdir = [], {}, {} 199 actions, copy, movewithdir = [], {}, {}
201 200
202 if overwrite: 201 if overwrite:
203 pa = p1 202 pa = p1
340 moves = [] 339 moves = []
341 actions.sort(key=actionkey) 340 actions.sort(key=actionkey)
342 341
343 # prescan for merges 342 # prescan for merges
344 for a in actions: 343 for a in actions:
345 f, m, args = a 344 f, m, args, msg = a
345 repo.ui.debug(" %s: %s -> %s\n" % (f, msg, m))
346 if m == "m": # merge 346 if m == "m": # merge
347 f2, fd, move = args 347 f2, fd, move = args
348 if fd == '.hgsubstate': # merged internally 348 if fd == '.hgsubstate': # merged internally
349 continue 349 continue
350 repo.ui.debug("preserving %s for resolve of %s\n" % (f, fd)) 350 repo.ui.debug(" preserving %s for resolve of %s\n" % (f, fd))
351 fcl = wctx[f] 351 fcl = wctx[f]
352 fco = mctx[f2] 352 fco = mctx[f2]
353 if mctx == actx: # backwards, use working dir parent as ancestor 353 if mctx == actx: # backwards, use working dir parent as ancestor
354 if fcl.parents(): 354 if fcl.parents():
355 fca = fcl.p1() 355 fca = fcl.p1()
372 audit(f) 372 audit(f)
373 util.unlinkpath(repo.wjoin(f)) 373 util.unlinkpath(repo.wjoin(f))
374 374
375 numupdates = len(actions) 375 numupdates = len(actions)
376 for i, a in enumerate(actions): 376 for i, a in enumerate(actions):
377 f, m, args = a 377 f, m, args, msg = a
378 repo.ui.progress(_('updating'), i + 1, item=f, total=numupdates, 378 repo.ui.progress(_('updating'), i + 1, item=f, total=numupdates,
379 unit=_('files')) 379 unit=_('files'))
380 if m == "r": # remove 380 if m == "r": # remove
381 repo.ui.note(_("removing %s\n") % f) 381 repo.ui.note(_("removing %s\n") % f)
382 audit(f) 382 audit(f)
466 466
467 def recordupdates(repo, actions, branchmerge): 467 def recordupdates(repo, actions, branchmerge):
468 "record merge actions to the dirstate" 468 "record merge actions to the dirstate"
469 469
470 for a in actions: 470 for a in actions:
471 f, m, args = a 471 f, m, args, msg = a
472 if m == "r": # remove 472 if m == "r": # remove
473 if branchmerge: 473 if branchmerge:
474 repo.dirstate.remove(f) 474 repo.dirstate.remove(f)
475 else: 475 else:
476 repo.dirstate.drop(f) 476 repo.dirstate.drop(f)