comparison mercurial/hg.py @ 5635:0c608a8d9c5f

merge: make return codes more sensible Commands that call merge were exiting with a return code equal to the number of unresolved files. We now return 1 if there are unresolved files.
author Matt Mackall <mpm@selenic.com>
date Mon, 10 Dec 2007 10:24:14 -0600
parents 9e209193f18d
children 4cf5a4950fc9
comparison
equal deleted inserted replaced
5634:2f74cfa29e8c 5635:0c608a8d9c5f
278 else: 278 else:
279 repo.ui.status(_("You can redo the full merge using:\n")) 279 repo.ui.status(_("You can redo the full merge using:\n"))
280 # len(pl)==1, otherwise _merge.update() would have raised util.Abort: 280 # len(pl)==1, otherwise _merge.update() would have raised util.Abort:
281 repo.ui.status(_(" hg update %s\n hg update %s\n") 281 repo.ui.status(_(" hg update %s\n hg update %s\n")
282 % (pl[0].rev(), repo.changectx(node).rev())) 282 % (pl[0].rev(), repo.changectx(node).rev()))
283 return stats[3] 283 return stats[3] > 0
284 284
285 def clean(repo, node, show_stats=True): 285 def clean(repo, node, show_stats=True):
286 """forcibly switch the working directory to node, clobbering changes""" 286 """forcibly switch the working directory to node, clobbering changes"""
287 stats = _merge.update(repo, node, False, True, None) 287 stats = _merge.update(repo, node, False, True, None)
288 if show_stats: _showstats(repo, stats) 288 if show_stats: _showstats(repo, stats)
289 return stats[3] 289 return stats[3] > 0
290 290
291 def merge(repo, node, force=None, remind=True): 291 def merge(repo, node, force=None, remind=True):
292 """branch merge with node, resolving changes""" 292 """branch merge with node, resolving changes"""
293 stats = _merge.update(repo, node, True, force, False) 293 stats = _merge.update(repo, node, True, force, False)
294 _showstats(repo, stats) 294 _showstats(repo, stats)
299 " hg update -C %s\n" 299 " hg update -C %s\n"
300 " hg merge %s\n") 300 " hg merge %s\n")
301 % (pl[0].rev(), pl[1].rev())) 301 % (pl[0].rev(), pl[1].rev()))
302 elif remind: 302 elif remind:
303 repo.ui.status(_("(branch merge, don't forget to commit)\n")) 303 repo.ui.status(_("(branch merge, don't forget to commit)\n"))
304 return stats[3] 304 return stats[3] > 0
305 305
306 def revert(repo, node, choose): 306 def revert(repo, node, choose):
307 """revert changes to revision in node without updating dirstate""" 307 """revert changes to revision in node without updating dirstate"""
308 return _merge.update(repo, node, False, True, choose)[3] 308 return _merge.update(repo, node, False, True, choose)[3] > 0
309 309
310 def verify(repo): 310 def verify(repo):
311 """verify the consistency of a repository""" 311 """verify the consistency of a repository"""
312 return _verify.verify(repo) 312 return _verify.verify(repo)