235 def _update(repo, node): return update(repo, node) |
235 def _update(repo, node): return update(repo, node) |
236 |
236 |
237 def update(repo, node): |
237 def update(repo, node): |
238 """update the working directory to node, merging linear changes""" |
238 """update the working directory to node, merging linear changes""" |
239 pl = repo.parents() |
239 pl = repo.parents() |
240 stats = _merge.update(repo, node, False, False, None, None) |
240 stats = _merge.update(repo, node, False, False, None) |
241 _showstats(repo, stats) |
241 _showstats(repo, stats) |
242 if stats[3]: |
242 if stats[3]: |
243 repo.ui.status(_("There are unresolved merges with" |
243 repo.ui.status(_("There are unresolved merges with" |
244 " locally modified files.\n")) |
244 " locally modified files.\n")) |
245 if stats[1]: |
245 if stats[1]: |
249 # len(pl)==1, otherwise _merge.update() would have raised util.Abort: |
249 # len(pl)==1, otherwise _merge.update() would have raised util.Abort: |
250 repo.ui.status(_(" hg update %s\n hg update %s\n") |
250 repo.ui.status(_(" hg update %s\n hg update %s\n") |
251 % (pl[0].rev(), repo.changectx(node).rev())) |
251 % (pl[0].rev(), repo.changectx(node).rev())) |
252 return stats[3] |
252 return stats[3] |
253 |
253 |
254 def clean(repo, node, wlock=None, show_stats=True): |
254 def clean(repo, node, show_stats=True): |
255 """forcibly switch the working directory to node, clobbering changes""" |
255 """forcibly switch the working directory to node, clobbering changes""" |
256 stats = _merge.update(repo, node, False, True, None, wlock) |
256 stats = _merge.update(repo, node, False, True, None) |
257 if show_stats: _showstats(repo, stats) |
257 if show_stats: _showstats(repo, stats) |
258 return stats[3] |
258 return stats[3] |
259 |
259 |
260 def merge(repo, node, force=None, remind=True, wlock=None): |
260 def merge(repo, node, force=None, remind=True): |
261 """branch merge with node, resolving changes""" |
261 """branch merge with node, resolving changes""" |
262 stats = _merge.update(repo, node, True, force, False, wlock) |
262 stats = _merge.update(repo, node, True, force, False) |
263 _showstats(repo, stats) |
263 _showstats(repo, stats) |
264 if stats[3]: |
264 if stats[3]: |
265 pl = repo.parents() |
265 pl = repo.parents() |
266 repo.ui.status(_("There are unresolved merges," |
266 repo.ui.status(_("There are unresolved merges," |
267 " you can redo the full merge using:\n" |
267 " you can redo the full merge using:\n" |
270 % (pl[0].rev(), pl[1].rev())) |
270 % (pl[0].rev(), pl[1].rev())) |
271 elif remind: |
271 elif remind: |
272 repo.ui.status(_("(branch merge, don't forget to commit)\n")) |
272 repo.ui.status(_("(branch merge, don't forget to commit)\n")) |
273 return stats[3] |
273 return stats[3] |
274 |
274 |
275 def revert(repo, node, choose, wlock): |
275 def revert(repo, node, choose): |
276 """revert changes to revision in node without updating dirstate""" |
276 """revert changes to revision in node without updating dirstate""" |
277 return _merge.update(repo, node, False, True, choose, wlock)[3] |
277 return _merge.update(repo, node, False, True, choose)[3] |
278 |
278 |
279 def verify(repo): |
279 def verify(repo): |
280 """verify the consistency of a repository""" |
280 """verify the consistency of a repository""" |
281 return _verify.verify(repo) |
281 return _verify.verify(repo) |