equal
deleted
inserted
replaced
5 # This software may be used and distributed according to the terms |
5 # This software may be used and distributed according to the terms |
6 # of the GNU General Public License, incorporated herein by reference. |
6 # of the GNU General Public License, incorporated herein by reference. |
7 '''mercurial bookmarks |
7 '''mercurial bookmarks |
8 |
8 |
9 Mercurial bookmarks are local moveable pointers to changesets. Every bookmark |
9 Mercurial bookmarks are local moveable pointers to changesets. Every bookmark |
10 points to a changesets identified by it's hash. If you commit a changeset |
10 points to a changeset identified by its hash. If you commit a changeset |
11 that is based on a changeset that has a bookmark on it, the bookmark is forwarded |
11 that is based on a changeset that has a bookmark on it, the bookmark is forwarded |
12 to the new changeset. |
12 to the new changeset. |
13 |
13 |
14 It is possible to use bookmark names in every revision lookup (e.g. hg merge, hg update) |
14 It is possible to use bookmark names in every revision lookup (e.g. hg merge, hg update) |
15 ''' |
15 ''' |
58 file.close() |
58 file.close() |
59 |
59 |
60 def bookmark(ui, repo, mark=None, rev=None, force=False, delete=False, move=None): |
60 def bookmark(ui, repo, mark=None, rev=None, force=False, delete=False, move=None): |
61 '''mercurial bookmarks |
61 '''mercurial bookmarks |
62 |
62 |
63 Bookmarks are pointer to certain commits that move when commiting. |
63 Bookmarks are pointers to certain commits that move when commiting. |
64 Bookmarks are local. They can be renamed, copied and deleted. |
64 Bookmarks are local. They can be renamed, copied and deleted. |
65 It is possible to use bookmark names in 'hg merge' and 'hg update' to |
65 It is possible to use bookmark names in 'hg merge' and 'hg update' to |
66 update to a given bookmark. |
66 update to a given bookmark. |
67 |
67 |
68 You can use 'hg bookmark [NAME]' to set a bookmark on the current tip |
68 You can use 'hg bookmark [NAME]' to set a bookmark on the current tip |
74 marks = parse(repo) |
74 marks = parse(repo) |
75 cur = repo.changectx('.').node() |
75 cur = repo.changectx('.').node() |
76 |
76 |
77 if move: |
77 if move: |
78 if move not in marks: |
78 if move not in marks: |
79 raise util.Abort(_("a bookmark of this name doesnot exists")) |
79 raise util.Abort(_("a bookmark of this name does not exist")) |
80 if mark in marks and not force: |
80 if mark in marks and not force: |
81 raise util.Abort(_("a bookmark of the same name already exists")) |
81 raise util.Abort(_("a bookmark of the same name already exists")) |
82 marks[mark] = marks[move] |
82 marks[mark] = marks[move] |
83 del marks[move] |
83 del marks[move] |
84 write(repo, marks) |
84 write(repo, marks) |
86 |
86 |
87 if delete: |
87 if delete: |
88 if mark == None: |
88 if mark == None: |
89 raise util.Abort(_("bookmark name required")) |
89 raise util.Abort(_("bookmark name required")) |
90 if mark not in marks: |
90 if mark not in marks: |
91 raise util.Abort(_("a bookmark of this name does not exists")) |
91 raise util.Abort(_("a bookmark of this name does not exist")) |
92 del marks[mark] |
92 del marks[mark] |
93 write(repo, marks) |
93 write(repo, marks) |
94 return |
94 return |
95 |
95 |
96 if mark != None: |
96 if mark != None: |