747 if srcpeer is not None: |
747 if srcpeer is not None: |
748 srcpeer.close() |
748 srcpeer.close() |
749 return srcpeer, destpeer |
749 return srcpeer, destpeer |
750 |
750 |
751 def _showstats(repo, stats, quietempty=False): |
751 def _showstats(repo, stats, quietempty=False): |
752 if quietempty and not any(stats): |
752 if quietempty and stats.isempty(): |
753 return |
753 return |
754 repo.ui.status(_("%d files updated, %d files merged, " |
754 repo.ui.status(_("%d files updated, %d files merged, " |
755 "%d files removed, %d files unresolved\n") % ( |
755 "%d files removed, %d files unresolved\n") % ( |
756 stats.updatedcount, stats.mergedcount, |
756 stats.updatedcount, stats.mergedcount, |
757 stats.removedcount, stats.unresolvedcount)) |
757 stats.removedcount, stats.unresolvedcount)) |
768 |
768 |
769 def update(repo, node, quietempty=False, updatecheck=None): |
769 def update(repo, node, quietempty=False, updatecheck=None): |
770 """update the working directory to node""" |
770 """update the working directory to node""" |
771 stats = updaterepo(repo, node, False, updatecheck=updatecheck) |
771 stats = updaterepo(repo, node, False, updatecheck=updatecheck) |
772 _showstats(repo, stats, quietempty) |
772 _showstats(repo, stats, quietempty) |
773 if stats[3]: |
773 if stats.unresolvedcount: |
774 repo.ui.status(_("use 'hg resolve' to retry unresolved file merges\n")) |
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 # naming conflict in clone() |
777 # naming conflict in clone() |
778 _update = update |
778 _update = update |
779 |
779 |
780 def clean(repo, node, show_stats=True, quietempty=False): |
780 def clean(repo, node, show_stats=True, quietempty=False): |
781 """forcibly switch the working directory to node, clobbering changes""" |
781 """forcibly switch the working directory to node, clobbering changes""" |
782 stats = updaterepo(repo, node, True) |
782 stats = updaterepo(repo, node, True) |
783 repo.vfs.unlinkpath('graftstate', ignoremissing=True) |
783 repo.vfs.unlinkpath('graftstate', ignoremissing=True) |
784 if show_stats: |
784 if show_stats: |
785 _showstats(repo, stats, quietempty) |
785 _showstats(repo, stats, quietempty) |
786 return stats[3] > 0 |
786 return stats.unresolvedcount > 0 |
787 |
787 |
788 # naming conflict in updatetotally() |
788 # naming conflict in updatetotally() |
789 _clean = clean |
789 _clean = clean |
790 |
790 |
791 def updatetotally(ui, repo, checkout, brev, clean=False, updatecheck=None): |
791 def updatetotally(ui, repo, checkout, brev, clean=False, updatecheck=None): |
880 " %s\n") % node[:12]) |
880 " %s\n") % node[:12]) |
881 stats = mergemod.update(repo, node, branchmerge=False, force=True, |
881 stats = mergemod.update(repo, node, branchmerge=False, force=True, |
882 labels=labels) |
882 labels=labels) |
883 |
883 |
884 _showstats(repo, stats) |
884 _showstats(repo, stats) |
885 if stats[3]: |
885 if stats.unresolvedcount: |
886 repo.ui.status(_("use 'hg resolve' to retry unresolved file merges " |
886 repo.ui.status(_("use 'hg resolve' to retry unresolved file merges " |
887 "or 'hg merge --abort' to abandon\n")) |
887 "or 'hg merge --abort' to abandon\n")) |
888 elif remind and not abort: |
888 elif remind and not abort: |
889 repo.ui.status(_("(branch merge, don't forget to commit)\n")) |
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 def _incoming(displaychlist, subreporecurse, ui, repo, source, |
892 def _incoming(displaychlist, subreporecurse, ui, repo, source, |
893 opts, buffered=False): |
893 opts, buffered=False): |
894 """ |
894 """ |
895 Helper for incoming / gincoming. |
895 Helper for incoming / gincoming. |