Mercurial > public > mercurial-scm > hg
comparison mercurial/hg.py @ 3316:39fd6e82ea38
merge: pull user messages out to hg.py
- add _update for shadowing in clone
- add _showstats helper
- remove update parameter defaults
- move stats message and merge help messages
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Tue, 10 Oct 2006 03:39:44 -0500 |
parents | 705e30c0a230 |
children | 145a8fde69e6 |
comparison
equal
deleted
inserted
replaced
3315:38be819a1225 | 3316:39fd6e82ea38 |
---|---|
199 | 199 |
200 if dest_lock: | 200 if dest_lock: |
201 dest_lock.release() | 201 dest_lock.release() |
202 | 202 |
203 if update: | 203 if update: |
204 _merge.update(dest_repo, dest_repo.changelog.tip()) | 204 _update(dest_repo, dest_repo.changelog.tip()) |
205 if dir_cleanup: | 205 if dir_cleanup: |
206 dir_cleanup.close() | 206 dir_cleanup.close() |
207 | 207 |
208 return src_repo, dest_repo | 208 return src_repo, dest_repo |
209 | 209 |
210 def _showstats(repo, stats): | |
211 stats = ((stats[0], _("updated")), | |
212 (stats[1], _("merged")), | |
213 (stats[2], _("removed")), | |
214 (stats[3], _("unresolved"))) | |
215 note = ", ".join([_("%d files %s") % s for s in stats]) | |
216 repo.ui.status("%s\n" % note) | |
217 | |
218 def _update(repo, node): return update(repo, node) | |
219 | |
210 def update(repo, node): | 220 def update(repo, node): |
211 """update the working directory to node, merging linear changes""" | 221 """update the working directory to node, merging linear changes""" |
212 return _merge.update(repo, node) | 222 stats = _merge.update(repo, node, False, False, None, None) |
223 _showstats(repo, stats) | |
224 if stats[3]: | |
225 repo.ui.status(_("There are unresolved merges with" | |
226 " locally modified files.\n")) | |
227 return stats[3] | |
213 | 228 |
214 def clean(repo, node, wlock=None, show_stats=True): | 229 def clean(repo, node, wlock=None, show_stats=True): |
215 """forcibly switch the working directory to node, clobbering changes""" | 230 """forcibly switch the working directory to node, clobbering changes""" |
216 return _merge.update(repo, node, force=True, wlock=wlock, | 231 stats = _merge.update(repo, node, False, True, None, wlock) |
217 show_stats=show_stats) | 232 if show_stats: _showstats(repo, stats) |
233 return stats[3] | |
218 | 234 |
219 def merge(repo, node, force=None, remind=True, wlock=None): | 235 def merge(repo, node, force=None, remind=True, wlock=None): |
220 """branch merge with node, resolving changes""" | 236 """branch merge with node, resolving changes""" |
221 return _merge.update(repo, node, branchmerge=True, force=force, | 237 stats = _merge.update(repo, node, True, force, False, wlock) |
222 remind=remind, wlock=wlock) | 238 _showstats(repo, stats) |
239 if stats[3]: | |
240 pl = repo.parents() | |
241 repo.ui.status(_("There are unresolved merges," | |
242 " you can redo the full merge using:\n" | |
243 " hg update -C %s\n" | |
244 " hg merge %s\n" | |
245 % (pl[0].rev(), pl[1].rev()))) | |
246 elif remind: | |
247 repo.ui.status(_("(branch merge, don't forget to commit)\n")) | |
248 return stats[3] | |
223 | 249 |
224 def revert(repo, node, choose, wlock): | 250 def revert(repo, node, choose, wlock): |
225 """revert changes to revision in node without updating dirstate""" | 251 """revert changes to revision in node without updating dirstate""" |
226 return _merge.update(repo, node, force=True, partial=choose, | 252 return _merge.update(repo, node, False, True, choose, wlock)[3] |
227 show_stats=False, wlock=wlock) | |
228 | 253 |
229 def verify(repo): | 254 def verify(repo): |
230 """verify the consistency of a repository""" | 255 """verify the consistency of a repository""" |
231 return _verify.verify(repo) | 256 return _verify.verify(repo) |