5631 def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False): |
5631 def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False): |
5632 """update working directory (or switch revisions) |
5632 """update working directory (or switch revisions) |
5633 |
5633 |
5634 Update the repository's working directory to the specified |
5634 Update the repository's working directory to the specified |
5635 changeset. If no changeset is specified, update to the tip of the |
5635 changeset. If no changeset is specified, update to the tip of the |
5636 current named branch. |
5636 current named branch and move the current bookmark. |
5637 |
5637 |
5638 If the changeset is not a descendant of the working directory's |
5638 If the changeset is not a descendant of the working directory's |
5639 parent, the update is aborted. With the -c/--check option, the |
5639 parent, the update is aborted. With the -c/--check option, the |
5640 working directory is checked for uncommitted changes; if none are |
5640 working directory is checked for uncommitted changes; if none are |
5641 found, the working directory is updated to the specified |
5641 found, the working directory is updated to the specified |
5676 raise util.Abort(_("please specify just one revision")) |
5676 raise util.Abort(_("please specify just one revision")) |
5677 |
5677 |
5678 if rev is None or rev == '': |
5678 if rev is None or rev == '': |
5679 rev = node |
5679 rev = node |
5680 |
5680 |
|
5681 # with no argument, we also move the current bookmark, if any |
|
5682 movemarkfrom = None |
|
5683 if node is None or node == '': |
|
5684 movemarkfrom = repo['.'].node() |
|
5685 |
5681 # if we defined a bookmark, we have to remember the original bookmark name |
5686 # if we defined a bookmark, we have to remember the original bookmark name |
5682 brev = rev |
5687 brev = rev |
5683 rev = scmutil.revsingle(repo, rev, rev).rev() |
5688 rev = scmutil.revsingle(repo, rev, rev).rev() |
5684 |
5689 |
5685 if check and clean: |
5690 if check and clean: |
5699 if clean or check: |
5704 if clean or check: |
5700 ret = hg.clean(repo, rev) |
5705 ret = hg.clean(repo, rev) |
5701 else: |
5706 else: |
5702 ret = hg.update(repo, rev) |
5707 ret = hg.update(repo, rev) |
5703 |
5708 |
5704 if brev in repo._bookmarks: |
5709 if not ret and movemarkfrom: |
|
5710 bookmarks.update(repo, [movemarkfrom], repo['.'].node()) |
|
5711 elif brev in repo._bookmarks: |
5705 bookmarks.setcurrent(repo, brev) |
5712 bookmarks.setcurrent(repo, brev) |
5706 |
5713 |
5707 return ret |
5714 return ret |
5708 |
5715 |
5709 @command('verify', []) |
5716 @command('verify', []) |