bookmarks: Set current bookmark if we create a new one on the tip
If track.current is enabled we set the newly created bookmark as the
current tracked bookmark. We do not do this if a revision is specified.
--- a/hgext/bookmarks.py Mon Mar 02 19:19:12 2009 -0600
+++ b/hgext/bookmarks.py Sun Mar 01 00:30:01 2009 +0100
@@ -164,6 +164,7 @@
marks[mark] = repo.lookup(rev)
else:
marks[mark] = repo.changectx('.').node()
+ setcurrent(repo, mark)
write(repo, marks)
return
--- a/tests/test-bookmarks-current Mon Mar 02 19:19:12 2009 -0600
+++ b/tests/test-bookmarks-current Sun Mar 01 00:30:01 2009 +0100
@@ -14,6 +14,9 @@
echo % set bookmark X
hg bookmark X
+echo % list bookmarks
+hg bookmark
+
echo % update to bookmark X
hg update X
--- a/tests/test-bookmarks-current.out Mon Mar 02 19:19:12 2009 -0600
+++ b/tests/test-bookmarks-current.out Sun Mar 01 00:30:01 2009 +0100
@@ -1,6 +1,8 @@
% no bookmarks
no bookmarks set
% set bookmark X
+% list bookmarks
+ * X -1:000000000000
% update to bookmark X
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
% list bookmarks
@@ -10,9 +12,9 @@
* Z -1:000000000000
% new bookmark Y
% list bookmarks
- Y -1:000000000000
- * Z -1:000000000000
+ * Y -1:000000000000
+ Z -1:000000000000
% commit
% list bookmarks
- Y -1:000000000000
- * Z 0:719295282060
+ * Y 0:719295282060
+ Z -1:000000000000