##// END OF EJS Templates
bookmarks: Avoid long lines
Joel Rosdahl -
r7252:104a8324 default
parent child Browse files
Show More
@@ -4,15 +4,18 b''
4 4 #
5 5 # This software may be used and distributed according to the terms
6 6 # of the GNU General Public License, incorporated herein by reference.
7
7 8 '''mercurial bookmarks
8 9
9 Mercurial bookmarks are local moveable pointers to changesets. Every bookmark
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
12 to the new changeset.
10 Mercurial bookmarks are local moveable pointers to changesets. Every
11 bookmark points to a changeset identified by its hash. If you commit a
12 changeset that is based on a changeset that has a bookmark on it, the
13 bookmark is forwarded to the new changeset.
13 14
14 It is possible to use bookmark names in every revision lookup (e.g. hg merge, hg update)
15 It is possible to use bookmark names in every revision lookup (e.g. hg
16 merge, hg update).
15 17 '''
18
16 19 from mercurial.commands import templateopts, hex, short
17 20 from mercurial.i18n import _
18 21 from mercurial import cmdutil, util, commands, changelog
@@ -20,14 +23,12 b' from mercurial.node import nullrev'
20 23 from mercurial.repo import RepoError
21 24 import mercurial, mercurial.localrepo, mercurial.repair, os
22 25
23
24 26 def parse(repo):
25 27 '''Parse .hg/bookmarks file and return a dictionary
26 28
27 Bookmarks are stored as {HASH}\s{NAME}\n (localtags format)
28 values in the .hg/bookmarks file.
29 They are read by the parse() method and returned as a dictionary with
30 name => hash values.
29 Bookmarks are stored as {HASH}\s{NAME}\n (localtags format) values
30 in the .hg/bookmarks file. They are read by the parse() method and
31 returned as a dictionary with name => hash values.
31 32
32 33 The parsed dictionary is cached until a write() operation is done.
33 34 '''
@@ -60,10 +61,10 b' def write(repo, refs):'
60 61 def bookmark(ui, repo, mark=None, rev=None, force=False, delete=False, move=None):
61 62 '''mercurial bookmarks
62 63
63 Bookmarks are pointers to certain commits that move when commiting.
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
66 update to a given bookmark.
64 Bookmarks are pointers to certain commits that move when
65 commiting. Bookmarks are local. They can be renamed, copied and
66 deleted. It is possible to use bookmark names in 'hg merge' and 'hg
67 update' to update to a given bookmark.
67 68
68 69 You can use 'hg bookmark [NAME]' to set a bookmark on the current tip
69 70 with the given name. If you specify a second [NAME] the bookmark is
@@ -100,7 +101,8 b' def bookmark(ui, repo, mark=None, rev=No'
100 101 raise util.Abort(_("a bookmark of the same name already exists"))
101 102 if ((mark in repo.branchtags() or mark == repo.dirstate.branch())
102 103 and not force):
103 raise util.Abort(_("a bookmark cannot have the name of an existing branch"))
104 raise util.Abort(
105 _("a bookmark cannot have the name of an existing branch"))
104 106 if rev:
105 107 marks[mark] = repo.lookup(rev)
106 108 else:
@@ -114,7 +116,8 b' def bookmark(ui, repo, mark=None, rev=No'
114 116 else:
115 117 for bmark, n in marks.iteritems():
116 118 prefix = (n == cur) and '*' or ' '
117 ui.write(" %s %-25s %d:%s\n" % (prefix, bmark, repo.changelog.rev(n), hexfn(n)))
119 ui.write(" %s %-25s %d:%s\n" % (
120 prefix, bmark, repo.changelog.rev(n), hexfn(n)))
118 121 return
119 122
120 123 def _revstostrip(changelog, node):
@@ -192,7 +195,8 b' def reposetup(ui, repo):'
192 195 except RepoError, inst:
193 196 pass
194 197
195 result = super(bookmark_repo, self).addchangegroup(source, srctype, url, emptyok)
198 result = super(bookmark_repo, self).addchangegroup(
199 source, srctype, url, emptyok)
196 200 if result > 1:
197 201 # We have more heads than before
198 202 return result
General Comments 0
You need to be logged in to leave comments. Login now