comparison mercurial/merge.py @ 27076:09139ccf3085

mergestate: add a method to return updated/merged/removed counts This will not only allow us to remove a bunch of duplicate code in applyupdates in an upcoming patch, it will also allow the resolve interface to be a lot simpler: it doesn't need to return the dirstate action to applyupdates.
author Siddharth Agarwal <sid0@fb.com>
date Fri, 20 Nov 2015 16:17:54 -0800
parents 6373330155b2
children ca3fbf9dad8c
comparison
equal deleted inserted replaced
27075:6373330155b2 27076:09139ccf3085
487 def resolve(self, dfile, wctx, labels=None): 487 def resolve(self, dfile, wctx, labels=None):
488 """run merge process (assuming premerge was run) for dfile 488 """run merge process (assuming premerge was run) for dfile
489 489
490 Returns the exit code of the merge.""" 490 Returns the exit code of the merge."""
491 return self._resolve(False, dfile, wctx, labels=labels)[1] 491 return self._resolve(False, dfile, wctx, labels=labels)[1]
492
493 def counts(self):
494 """return counts for updated, merged and removed files in this
495 session"""
496 updated, merged, removed = 0, 0, 0
497 for r, action in self._results.itervalues():
498 if r is None:
499 updated += 1
500 elif r == 0:
501 if action == 'r':
502 removed += 1
503 else:
504 merged += 1
505 return updated, merged, removed
492 506
493 def _checkunknownfile(repo, wctx, mctx, f, f2=None): 507 def _checkunknownfile(repo, wctx, mctx, f, f2=None):
494 if f2 is None: 508 if f2 is None:
495 f2 = f 509 f2 = f
496 return (os.path.isfile(repo.wjoin(f)) 510 return (os.path.isfile(repo.wjoin(f))