Commits

php committed f420eaf

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.

Comments (0)

Files changed (3)

hgext/bookmarks.py

             marks[mark] = repo.lookup(rev)
         else:
             marks[mark] = repo.changectx('.').node()
+            setcurrent(repo, mark)
         write(repo, marks)
         return
 

tests/test-bookmarks-current

 echo % set bookmark X
 hg bookmark X
 
+echo % list bookmarks
+hg bookmark
+
 echo % update to bookmark X
 hg update X
 

tests/test-bookmarks-current.out

 % 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
  * 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