##// END OF EJS Templates
merge: deprecate accessing update results by index...
Gregory Szorc -
r37143:6f570c50 default
parent child Browse files
Show More
@@ -499,7 +499,7 b' class histeditaction(object):'
499 499 hg.update(repo, self.state.parentctxnode, quietempty=True)
500 500 stats = applychanges(repo.ui, repo, rulectx, {})
501 501 repo.dirstate.setbranch(rulectx.branch())
502 if stats and stats[3] > 0:
502 if stats.unresolvedcount:
503 503 buf = repo.ui.popbuffer()
504 504 repo.ui.write(buf)
505 505 raise error.InterventionRequired(
@@ -525,7 +525,7 b' class rebaseruntime(object):'
525 525 with ui.configoverride(overrides, 'rebase'):
526 526 stats = rebasenode(repo, rev, p1, base, self.collapsef,
527 527 dest, wctx=self.wctx)
528 if stats[3] > 0:
528 if stats.unresolvedcount > 0:
529 529 if self.inmemory:
530 530 raise error.InMemoryMergeConflictsError()
531 531 else:
@@ -629,7 +629,7 b' def _dobackout(ui, repo, node=None, rev='
629 629 repo.setparents(op1, op2)
630 630 dsguard.close()
631 631 hg._showstats(repo, stats)
632 if stats[3]:
632 if stats.unresolvedcount:
633 633 repo.ui.status(_("use 'hg resolve' to retry unresolved "
634 634 "file merges\n"))
635 635 return 1
@@ -2311,7 +2311,7 b' def _dograft(ui, repo, *revs, **opts):'
2311 2311 finally:
2312 2312 repo.ui.setconfig('ui', 'forcemerge', '', 'graft')
2313 2313 # report any conflicts
2314 if stats[3] > 0:
2314 if stats.unresolvedcount > 0:
2315 2315 # write out state for --continue
2316 2316 nodelines = [repo[rev].hex() + "\n" for rev in revs[pos:]]
2317 2317 repo.vfs.write('graftstate', ''.join(nodelines))
@@ -749,7 +749,7 b' def clone(ui, peeropts, source, dest=Non'
749 749 return srcpeer, destpeer
750 750
751 751 def _showstats(repo, stats, quietempty=False):
752 if quietempty and not any(stats):
752 if quietempty and stats.isempty():
753 753 return
754 754 repo.ui.status(_("%d files updated, %d files merged, "
755 755 "%d files removed, %d files unresolved\n") % (
@@ -770,9 +770,9 b' def update(repo, node, quietempty=False,'
770 770 """update the working directory to node"""
771 771 stats = updaterepo(repo, node, False, updatecheck=updatecheck)
772 772 _showstats(repo, stats, quietempty)
773 if stats[3]:
773 if stats.unresolvedcount:
774 774 repo.ui.status(_("use 'hg resolve' to retry unresolved file merges\n"))
775 return stats[3] > 0
775 return stats.unresolvedcount > 0
776 776
777 777 # naming conflict in clone()
778 778 _update = update
@@ -783,7 +783,7 b' def clean(repo, node, show_stats=True, q'
783 783 repo.vfs.unlinkpath('graftstate', ignoremissing=True)
784 784 if show_stats:
785 785 _showstats(repo, stats, quietempty)
786 return stats[3] > 0
786 return stats.unresolvedcount > 0
787 787
788 788 # naming conflict in updatetotally()
789 789 _clean = clean
@@ -882,12 +882,12 b' def merge(repo, node, force=None, remind'
882 882 labels=labels)
883 883
884 884 _showstats(repo, stats)
885 if stats[3]:
885 if stats.unresolvedcount:
886 886 repo.ui.status(_("use 'hg resolve' to retry unresolved file merges "
887 887 "or 'hg merge --abort' to abandon\n"))
888 888 elif remind and not abort:
889 889 repo.ui.status(_("(branch merge, don't forget to commit)\n"))
890 return stats[3] > 0
890 return stats.unresolvedcount > 0
891 891
892 892 def _incoming(displaychlist, subreporecurse, ui, repo, source,
893 893 opts, buffered=False):
@@ -1483,9 +1483,15 b' class updateresult(object):'
1483 1483 removedcount = attr.ib()
1484 1484 unresolvedcount = attr.ib()
1485 1485
1486 def isempty(self):
1487 return (not self.updatedcount and not self.mergedcount
1488 and not self.removedcount and not self.unresolvedcount)
1489
1486 1490 # TODO remove container emulation once consumers switch to new API.
1487 1491
1488 1492 def __getitem__(self, x):
1493 util.nouideprecwarn('access merge.update() results by name instead of '
1494 'index', '4.6', 2)
1489 1495 if x == 0:
1490 1496 return self.updatedcount
1491 1497 elif x == 1:
@@ -1498,6 +1504,8 b' class updateresult(object):'
1498 1504 raise IndexError('can only access items 0-3')
1499 1505
1500 1506 def __len__(self):
1507 util.nouideprecwarn('access merge.update() results by name instead of '
1508 'index', '4.6', 2)
1501 1509 return 4
1502 1510
1503 1511 def applyupdates(repo, actions, wctx, mctx, overwrite, labels=None):
@@ -2164,7 +2172,8 b' def update(repo, node, branchmerge, forc'
2164 2172 sparse.prunetemporaryincludes(repo)
2165 2173
2166 2174 if not partial:
2167 repo.hook('update', parent1=xp1, parent2=xp2, error=stats[3])
2175 repo.hook('update', parent1=xp1, parent2=xp2,
2176 error=stats.unresolvedcount)
2168 2177 return stats
2169 2178
2170 2179 def graft(repo, ctx, pctx, labels, keepparent=False):
General Comments 0
You need to be logged in to leave comments. Login now