Show More
@@ -201,30 +201,55 b' def clone(ui, source, dest=None, pull=Fa' | |||
|
201 | 201 | dest_lock.release() |
|
202 | 202 | |
|
203 | 203 | if update: |
|
204 |
_ |
|
|
204 | _update(dest_repo, dest_repo.changelog.tip()) | |
|
205 | 205 | if dir_cleanup: |
|
206 | 206 | dir_cleanup.close() |
|
207 | 207 | |
|
208 | 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 | 220 | def update(repo, node): |
|
211 | 221 | """update the working directory to node, merging linear changes""" |
|
212 |
|
|
|
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 | 229 | def clean(repo, node, wlock=None, show_stats=True): |
|
215 | 230 | """forcibly switch the working directory to node, clobbering changes""" |
|
216 |
|
|
|
217 | show_stats=show_stats) | |
|
231 | stats = _merge.update(repo, node, False, True, None, wlock) | |
|
232 | if show_stats: _showstats(repo, stats) | |
|
233 | return stats[3] | |
|
218 | 234 | |
|
219 | 235 | def merge(repo, node, force=None, remind=True, wlock=None): |
|
220 | 236 | """branch merge with node, resolving changes""" |
|
221 |
|
|
|
222 | remind=remind, wlock=wlock) | |
|
237 | stats = _merge.update(repo, node, True, force, False, 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 | 250 | def revert(repo, node, choose, wlock): |
|
225 | 251 | """revert changes to revision in node without updating dirstate""" |
|
226 |
return _merge.update(repo, node, |
|
|
227 | show_stats=False, wlock=wlock) | |
|
252 | return _merge.update(repo, node, False, True, choose, wlock)[3] | |
|
228 | 253 | |
|
229 | 254 | def verify(repo): |
|
230 | 255 | """verify the consistency of a repository""" |
@@ -291,15 +291,14 b' def applyupdates(repo, action, wctx, mct' | |||
|
291 | 291 | if filemerge(repo, f, f2, wctx, mctx): |
|
292 | 292 | unresolved += 1 |
|
293 | 293 | else: |
|
294 | merged += 1 | |
|
294 | 295 | if f != fd: |
|
295 | 296 | repo.ui.debug(_("copying %s to %s\n") % (f, fd)) |
|
296 | 297 | repo.wwrite(fd, repo.wread(f)) |
|
297 | 298 | if move: |
|
298 | 299 | repo.ui.debug(_("removing %s\n") % f) |
|
299 | 300 | os.unlink(repo.wjoin(f)) |
|
300 | ||
|
301 | 301 | util.set_exec(repo.wjoin(fd), flag) |
|
302 | merged += 1 | |
|
303 | 302 | elif m == "g": # get |
|
304 | 303 | flag = a[2] |
|
305 | 304 | repo.ui.note(_("getting %s\n") % f) |
@@ -352,8 +351,7 b' def recordupdates(repo, action, branchme' | |||
|
352 | 351 | else: |
|
353 | 352 | repo.dirstate.copy(f2, fd) |
|
354 | 353 | |
|
355 |
def update(repo, node, branchmerge |
|
|
356 | wlock=None, show_stats=True, remind=True): | |
|
354 | def update(repo, node, branchmerge, force, partial, wlock): | |
|
357 | 355 | """ |
|
358 | 356 | Perform a merge between the working directory and the given node |
|
359 | 357 | |
@@ -361,8 +359,6 b' def update(repo, node, branchmerge=False' | |||
|
361 | 359 | force = whether to force branch merging or file overwriting |
|
362 | 360 | partial = a function to filter file lists (dirstate not updated) |
|
363 | 361 | wlock = working dir lock, if already held |
|
364 | show_stats = whether to report merge statistics | |
|
365 | remind = whether to remind about merge | |
|
366 | 362 | """ |
|
367 | 363 | |
|
368 | 364 | if not wlock: |
@@ -404,32 +400,12 b' def update(repo, node, branchmerge=False' | |||
|
404 | 400 | if not partial: |
|
405 | 401 | repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2) |
|
406 | 402 | |
|
407 |
|
|
|
403 | stats = applyupdates(repo, action, wc, p2) | |
|
408 | 404 | |
|
409 | if show_stats: | |
|
410 | stats = ((updated, _("updated")), | |
|
411 | (merged - unresolved, _("merged")), | |
|
412 | (removed, _("removed")), | |
|
413 | (unresolved, _("unresolved"))) | |
|
414 | note = ", ".join([_("%d files %s") % s for s in stats]) | |
|
415 | repo.ui.status("%s\n" % note) | |
|
416 | 405 | if not partial: |
|
417 | 406 | recordupdates(repo, action, branchmerge, p2) |
|
418 | 407 | repo.dirstate.setparents(fp1, fp2) |
|
419 |
repo.hook('update', parent1=xp1, parent2=xp2, error= |
|
|
408 | repo.hook('update', parent1=xp1, parent2=xp2, error=stats[3]) | |
|
420 | 409 | |
|
421 | if branchmerge: | |
|
422 | if unresolved: | |
|
423 | repo.ui.status(_("There are unresolved merges," | |
|
424 | " you can redo the full merge using:\n" | |
|
425 | " hg update -C %s\n" | |
|
426 | " hg merge %s\n" | |
|
427 | % (p1.rev(), p2.rev()))) | |
|
428 | elif remind: | |
|
429 | repo.ui.status(_("(branch merge, don't forget to commit)\n")) | |
|
430 | elif unresolved: | |
|
431 | repo.ui.status(_("There are unresolved merges with" | |
|
432 | " locally modified files.\n")) | |
|
410 | return stats | |
|
433 | 411 | |
|
434 | return unresolved | |
|
435 |
General Comments 0
You need to be logged in to leave comments.
Login now