##// END OF EJS Templates
update: wlock the repo for the whole 'hg update' command...
Pierre-Yves David -
r26028:6fbe3558 stable
parent child Browse files
Show More
@@ -6451,51 +6451,55 b' def update(ui, repo, node=None, rev=None'
6451 if rev is None or rev == '':
6451 if rev is None or rev == '':
6452 rev = node
6452 rev = node
6453
6453
6454 cmdutil.clearunfinished(repo)
6454 wlock = repo.wlock()
6455
6455 try:
6456 # with no argument, we also move the active bookmark, if any
6456 cmdutil.clearunfinished(repo)
6457 rev, movemarkfrom = bookmarks.calculateupdate(ui, repo, rev)
6457
6458
6458 # with no argument, we also move the active bookmark, if any
6459 # if we defined a bookmark, we have to remember the original bookmark name
6459 rev, movemarkfrom = bookmarks.calculateupdate(ui, repo, rev)
6460 brev = rev
6460
6461 rev = scmutil.revsingle(repo, rev, rev).rev()
6461 # if we defined a bookmark, we have to remember the original name
6462
6462 brev = rev
6463 if check and clean:
6463 rev = scmutil.revsingle(repo, rev, rev).rev()
6464 raise util.Abort(_("cannot specify both -c/--check and -C/--clean"))
6464
6465
6465 if check and clean:
6466 if date:
6466 raise util.Abort(_("cannot specify both -c/--check and -C/--clean"))
6467 if rev is not None:
6467
6468 raise util.Abort(_("you can't specify a revision and a date"))
6468 if date:
6469 rev = cmdutil.finddate(ui, repo, date)
6469 if rev is not None:
6470
6470 raise util.Abort(_("you can't specify a revision and a date"))
6471 if check:
6471 rev = cmdutil.finddate(ui, repo, date)
6472 cmdutil.bailifchanged(repo, merge=False)
6472
6473 if rev is None:
6473 if check:
6474 rev = repo[repo[None].branch()].rev()
6474 cmdutil.bailifchanged(repo, merge=False)
6475
6475 if rev is None:
6476 repo.ui.setconfig('ui', 'forcemerge', tool, 'update')
6476 rev = repo[repo[None].branch()].rev()
6477
6477
6478 if clean:
6478 repo.ui.setconfig('ui', 'forcemerge', tool, 'update')
6479 ret = hg.clean(repo, rev)
6479
6480 else:
6480 if clean:
6481 ret = hg.update(repo, rev)
6481 ret = hg.clean(repo, rev)
6482
6483 if not ret and movemarkfrom:
6484 if bookmarks.update(repo, [movemarkfrom], repo['.'].node()):
6485 ui.status(_("updating bookmark %s\n") % repo._activebookmark)
6486 else:
6482 else:
6487 # this can happen with a non-linear update
6483 ret = hg.update(repo, rev)
6488 ui.status(_("(leaving bookmark %s)\n") %
6484
6489 repo._activebookmark)
6485 if not ret and movemarkfrom:
6486 if bookmarks.update(repo, [movemarkfrom], repo['.'].node()):
6487 ui.status(_("updating bookmark %s\n") % repo._activebookmark)
6488 else:
6489 # this can happen with a non-linear update
6490 ui.status(_("(leaving bookmark %s)\n") %
6491 repo._activebookmark)
6492 bookmarks.deactivate(repo)
6493 elif brev in repo._bookmarks:
6494 bookmarks.activate(repo, brev)
6495 ui.status(_("(activating bookmark %s)\n") % brev)
6496 elif brev:
6497 if repo._activebookmark:
6498 ui.status(_("(leaving bookmark %s)\n") %
6499 repo._activebookmark)
6490 bookmarks.deactivate(repo)
6500 bookmarks.deactivate(repo)
6491 elif brev in repo._bookmarks:
6501 finally:
6492 bookmarks.activate(repo, brev)
6502 wlock.release()
6493 ui.status(_("(activating bookmark %s)\n") % brev)
6494 elif brev:
6495 if repo._activebookmark:
6496 ui.status(_("(leaving bookmark %s)\n") %
6497 repo._activebookmark)
6498 bookmarks.deactivate(repo)
6499
6503
6500 return ret
6504 return ret
6501
6505
@@ -119,8 +119,8 b' extension and python hooks - use the eol'
119 $ echo '[hooks]' >> .hg/hgrc
119 $ echo '[hooks]' >> .hg/hgrc
120 $ echo 'update = echo hooked' >> .hg/hgrc
120 $ echo 'update = echo hooked' >> .hg/hgrc
121 $ hg update
121 $ hg update
122 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
122 hooked
123 hooked
123 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
124 $ hg blackbox -l 5
124 $ hg blackbox -l 5
125 1970/01/01 00:00:00 bob> update
125 1970/01/01 00:00:00 bob> update
126 1970/01/01 00:00:00 bob> writing .hg/cache/tags2-visible with 0 tags
126 1970/01/01 00:00:00 bob> writing .hg/cache/tags2-visible with 0 tags
@@ -223,8 +223,8 b' update hook'
223 $ echo "update = printenv.py update" >> .hg/hgrc
223 $ echo "update = printenv.py update" >> .hg/hgrc
224 $ hg update
224 $ hg update
225 preupdate hook: HG_PARENT1=539e4b31b6dc
225 preupdate hook: HG_PARENT1=539e4b31b6dc
226 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
226 update hook: HG_ERROR=0 HG_PARENT1=539e4b31b6dc
227 update hook: HG_ERROR=0 HG_PARENT1=539e4b31b6dc
227 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
228
228
229 pushkey hook
229 pushkey hook
230
230
@@ -644,8 +644,8 b' final release (and dirstate flush).'
644 $ hg ci -ma
644 $ hg ci -ma
645 223eafe2750c tip
645 223eafe2750c tip
646 $ hg up 0 --config extensions.largefiles=
646 $ hg up 0 --config extensions.largefiles=
647 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
647 cb9a9f314b8b
648 cb9a9f314b8b
648 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
649
649
650 make sure --verbose (and --quiet/--debug etc.) are propagated to the local ui
650 make sure --verbose (and --quiet/--debug etc.) are propagated to the local ui
651 that is passed to pre/post hooks
651 that is passed to pre/post hooks
@@ -59,7 +59,6 b' One process waiting for another'
59 $ hg -R b up -q --config hooks.pre-update="python:`pwd`/hooks.py:sleephalf"
59 $ hg -R b up -q --config hooks.pre-update="python:`pwd`/hooks.py:sleephalf"
60 waiting for lock on working directory of b held by '*:*' (glob)
60 waiting for lock on working directory of b held by '*:*' (glob)
61 got lock after ? seconds (glob)
61 got lock after ? seconds (glob)
62 warning: ignoring unknown working parent d2ae7f538514!
63 $ wait
62 $ wait
64 $ cat stdout
63 $ cat stdout
65 adding b
64 adding b
General Comments 0
You need to be logged in to leave comments. Login now