[PATCH 2 of 2 RFC] update: forward current bookmark when no cset is specified
Idan Kamara
idankk86 at gmail.com
Tue Apr 19 07:34:25 CDT 2011
# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1303216004 -10800
# Node ID f36d358e04aa7f9822f45f5226c7d01f253a57a9
# Parent 34ab2c32c565e9cac7f688fc0ab187f6bb2353a5
update: forward current bookmark when no cset is specified
diff -r 34ab2c32c565 -r f36d358e04aa mercurial/commands.py
--- a/mercurial/commands.py Tue Apr 19 15:01:46 2011 +0300
+++ b/mercurial/commands.py Tue Apr 19 15:26:44 2011 +0300
@@ -4142,7 +4142,7 @@
Update the repository's working directory to the specified
changeset. If no changeset is specified, update to the tip of the
- current named branch.
+ current named branch. If there's a current bookmark, update it as well.
If the changeset is not a descendant of the working directory's
parent, the update is aborted. With the -c/--check option, the
@@ -4202,6 +4202,8 @@
raise util.Abort(_("you can't specify a revision and a date"))
rev = cmdutil.finddate(ui, repo, date)
+ wc = repo['.']
+
if clean or check:
ret = hg.clean(repo, rev)
else:
@@ -4213,6 +4215,9 @@
# 'hg update X' where X isn't a bookmark
elif rev or rev == 0:
bookmarks.unsetcurrent(repo)
+ # 'hg update' when we have a current bookmark, forward it
+ elif repo._bookmarkcurrent:
+ bookmarks.updatecurrentbookmark(repo, wc.node(), wc.branch())
return ret
diff -r 34ab2c32c565 -r f36d358e04aa tests/test-bookmarks-pushpull.t
--- a/tests/test-bookmarks-pushpull.t Tue Apr 19 15:01:46 2011 +0300
+++ b/tests/test-bookmarks-pushpull.t Tue Apr 19 15:26:44 2011 +0300
@@ -97,7 +97,7 @@
Z 1:0d2164f0ce0d
$ cd ../b
- $ hg up
+ $ hg up 0
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo c2 > f2
$ hg ci -Am2
More information about the Mercurial-devel
mailing list