Show More
@@ -23,12 +23,12 b' import mercurial, mercurial.localrepo, m' | |||||
23 |
|
23 | |||
24 | def parse(repo): |
|
24 | def parse(repo): | |
25 | '''Parse .hg/bookmarks file and return a dictionary |
|
25 | '''Parse .hg/bookmarks file and return a dictionary | |
26 |
|
26 | |||
27 |
Bookmarks are stored as {HASH}\s{NAME}\n (localtags format) |
|
27 | Bookmarks are stored as {HASH}\s{NAME}\n (localtags format) | |
28 | values in the .hg/bookmarks file. |
|
28 | values in the .hg/bookmarks file. | |
29 | They are read by the parse() method and returned as a dictionary with |
|
29 | They are read by the parse() method and returned as a dictionary with | |
30 | name => hash values. |
|
30 | name => hash values. | |
31 |
|
31 | |||
32 | The parsed dictionary is cached until a write() operation is done. |
|
32 | The parsed dictionary is cached until a write() operation is done. | |
33 | ''' |
|
33 | ''' | |
34 | try: |
|
34 | try: | |
@@ -44,7 +44,7 b' def parse(repo):' | |||||
44 |
|
44 | |||
45 | def write(repo, refs): |
|
45 | def write(repo, refs): | |
46 | '''Write bookmarks |
|
46 | '''Write bookmarks | |
47 |
|
47 | |||
48 | Write the given bookmark => hash dictionary to the .hg/bookmarks file |
|
48 | Write the given bookmark => hash dictionary to the .hg/bookmarks file | |
49 | in a format equal to those of localtags. |
|
49 | in a format equal to those of localtags. | |
50 |
|
50 | |||
@@ -59,12 +59,12 b' def write(repo, refs):' | |||||
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 pointer 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 | |
69 | with the given name. If you specify a second [NAME] the bookmark is |
|
69 | with the given name. If you specify a second [NAME] the bookmark is | |
70 | set to the bookmark that has that name. You can also pass revision |
|
70 | set to the bookmark that has that name. You can also pass revision | |
@@ -83,7 +83,7 b' def bookmark(ui, repo, mark=None, rev=No' | |||||
83 | del marks[move] |
|
83 | del marks[move] | |
84 | write(repo, marks) |
|
84 | write(repo, marks) | |
85 | return |
|
85 | return | |
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")) | |
@@ -98,7 +98,7 b' def bookmark(ui, repo, mark=None, rev=No' | |||||
98 | raise Exception("bookmark cannot contain newlines") |
|
98 | raise Exception("bookmark cannot contain newlines") | |
99 | if mark in marks and not force: |
|
99 | if mark in marks and not force: | |
100 | raise util.Abort(_("a bookmark of the same name already exists")) |
|
100 | raise util.Abort(_("a bookmark of the same name already exists")) | |
101 |
if ((mark in repo.branchtags() or mark == repo.dirstate.branch()) |
|
101 | if ((mark in repo.branchtags() or mark == repo.dirstate.branch()) | |
102 | and not force): |
|
102 | and not force): | |
103 | raise util.Abort(_("a bookmark cannot have the name of an existing branch")) |
|
103 | raise util.Abort(_("a bookmark cannot have the name of an existing branch")) | |
104 | if rev: |
|
104 | if rev: | |
@@ -162,7 +162,7 b' def reposetup(ui, repo):' | |||||
162 | def rollback(self): |
|
162 | def rollback(self): | |
163 | if os.path.exists(self.join('undo.bookmarks')): |
|
163 | if os.path.exists(self.join('undo.bookmarks')): | |
164 | util.rename(self.join('undo.bookmarks'), self.join('bookmarks')) |
|
164 | util.rename(self.join('undo.bookmarks'), self.join('bookmarks')) | |
165 |
return super(bookmark_repo, self).rollback() |
|
165 | return super(bookmark_repo, self).rollback() | |
166 |
|
166 | |||
167 | def lookup(self, key): |
|
167 | def lookup(self, key): | |
168 | if self._bookmarks is None: |
|
168 | if self._bookmarks is None: |
General Comments 0
You need to be logged in to leave comments.
Login now