Show More
@@ -0,0 +1,41 b'' | |||||
|
1 | #!/bin/sh | |||
|
2 | ||||
|
3 | echo "[extensions]" >> $HGRCPATH | |||
|
4 | echo "bookmarks=" >> $HGRCPATH | |||
|
5 | ||||
|
6 | echo "[bookmarks]" >> $HGRCPATH | |||
|
7 | echo "track.current = True" >> $HGRCPATH | |||
|
8 | ||||
|
9 | hg init | |||
|
10 | ||||
|
11 | echo % no bookmarks | |||
|
12 | hg bookmarks | |||
|
13 | ||||
|
14 | echo % set bookmark X | |||
|
15 | hg bookmark X | |||
|
16 | ||||
|
17 | echo % update to bookmark X | |||
|
18 | hg update X | |||
|
19 | ||||
|
20 | echo % list bookmarks | |||
|
21 | hg bookmarks | |||
|
22 | ||||
|
23 | echo % rename | |||
|
24 | hg bookmark -m X Z | |||
|
25 | ||||
|
26 | echo % list bookmarks | |||
|
27 | hg bookmarks | |||
|
28 | ||||
|
29 | echo % new bookmark Y | |||
|
30 | hg bookmark Y | |||
|
31 | ||||
|
32 | echo % list bookmarks | |||
|
33 | hg bookmark | |||
|
34 | ||||
|
35 | echo % commit | |||
|
36 | echo 'b' > b | |||
|
37 | hg add b | |||
|
38 | hg commit -m'test' | |||
|
39 | ||||
|
40 | echo % list bookmarks | |||
|
41 | hg bookmark |
@@ -0,0 +1,18 b'' | |||||
|
1 | % no bookmarks | |||
|
2 | no bookmarks set | |||
|
3 | % set bookmark X | |||
|
4 | % update to bookmark X | |||
|
5 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
6 | % list bookmarks | |||
|
7 | * X -1:000000000000 | |||
|
8 | % rename | |||
|
9 | % list bookmarks | |||
|
10 | * Z -1:000000000000 | |||
|
11 | % new bookmark Y | |||
|
12 | % list bookmarks | |||
|
13 | Y -1:000000000000 | |||
|
14 | * Z -1:000000000000 | |||
|
15 | % commit | |||
|
16 | % list bookmarks | |||
|
17 | Y -1:000000000000 | |||
|
18 | * Z 0:719295282060 |
@@ -64,9 +64,9 b' def write(repo, refs):' | |||||
64 | ''' |
|
64 | ''' | |
65 | if os.path.exists(repo.join('bookmarks')): |
|
65 | if os.path.exists(repo.join('bookmarks')): | |
66 | util.copyfile(repo.join('bookmarks'), repo.join('undo.bookmarks')) |
|
66 | util.copyfile(repo.join('bookmarks'), repo.join('undo.bookmarks')) | |
67 | file = repo.opener('bookmarks', 'w+') |
|
|||
68 | if current(repo) not in refs: |
|
67 | if current(repo) not in refs: | |
69 | setcurrent(repo, None) |
|
68 | setcurrent(repo, None) | |
|
69 | file = repo.opener('bookmarks', 'w+') | |||
70 | for refspec, node in refs.items(): |
|
70 | for refspec, node in refs.items(): | |
71 | file.write("%s %s\n" % (hex(node), refspec)) |
|
71 | file.write("%s %s\n" % (hex(node), refspec)) | |
72 | file.close() |
|
72 | file.close() | |
@@ -138,6 +138,8 b' def bookmark(ui, repo, mark=None, rev=No' | |||||
138 | raise util.Abort(_("new bookmark name required")) |
|
138 | raise util.Abort(_("new bookmark name required")) | |
139 | marks[mark] = marks[rename] |
|
139 | marks[mark] = marks[rename] | |
140 | del marks[rename] |
|
140 | del marks[rename] | |
|
141 | if current(repo) == rename: | |||
|
142 | setcurrent(repo, mark) | |||
141 | write(repo, marks) |
|
143 | write(repo, marks) | |
142 | return |
|
144 | return | |
143 |
|
145 |
General Comments 0
You need to be logged in to leave comments.
Login now