##// 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 # 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
7 '''mercurial bookmarks
8 '''mercurial bookmarks
8
9
9 Mercurial bookmarks are local moveable pointers to changesets. Every bookmark
10 Mercurial bookmarks are local moveable pointers to changesets. Every
10 points to a changeset identified by its hash. If you commit a changeset
11 bookmark points to a changeset identified by its hash. If you commit a
11 that is based on a changeset that has a bookmark on it, the bookmark is forwarded
12 changeset that is based on a changeset that has a bookmark on it, the
12 to the new changeset.
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 from mercurial.commands import templateopts, hex, short
19 from mercurial.commands import templateopts, hex, short
17 from mercurial.i18n import _
20 from mercurial.i18n import _
18 from mercurial import cmdutil, util, commands, changelog
21 from mercurial import cmdutil, util, commands, changelog
@@ -20,14 +23,12 b' from mercurial.node import nullrev'
20 from mercurial.repo import RepoError
23 from mercurial.repo import RepoError
21 import mercurial, mercurial.localrepo, mercurial.repair, os
24 import mercurial, mercurial.localrepo, mercurial.repair, os
22
25
23
24 def parse(repo):
26 def parse(repo):
25 '''Parse .hg/bookmarks file and return a dictionary
27 '''Parse .hg/bookmarks file and return a dictionary
26
28
27 Bookmarks are stored as {HASH}\s{NAME}\n (localtags format)
29 Bookmarks are stored as {HASH}\s{NAME}\n (localtags format) values
28 values in the .hg/bookmarks file.
30 in the .hg/bookmarks file. They are read by the parse() method and
29 They are read by the parse() method and returned as a dictionary with
31 returned as a dictionary with name => hash values.
30 name => hash values.
31
32
32 The parsed dictionary is cached until a write() operation is done.
33 The parsed dictionary is cached until a write() operation is done.
33 '''
34 '''
@@ -60,10 +61,10 b' def write(repo, refs):'
60 def bookmark(ui, repo, mark=None, rev=None, force=False, delete=False, move=None):
61 def bookmark(ui, repo, mark=None, rev=None, force=False, delete=False, move=None):
61 '''mercurial bookmarks
62 '''mercurial bookmarks
62
63
63 Bookmarks are pointers to certain commits that move when commiting.
64 Bookmarks are pointers to certain commits that move when
64 Bookmarks are local. They can be renamed, copied and deleted.
65 commiting. Bookmarks are local. They can be renamed, copied and
65 It is possible to use bookmark names in 'hg merge' and 'hg update' to
66 deleted. It is possible to use bookmark names in 'hg merge' and 'hg
66 update to a given bookmark.
67 update' to update to a given bookmark.
67
68
68 You can use 'hg bookmark [NAME]' to set a bookmark on the current tip
69 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
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 raise util.Abort(_("a bookmark of the same name already exists"))
101 raise util.Abort(_("a bookmark of the same name already exists"))
101 if ((mark in repo.branchtags() or mark == repo.dirstate.branch())
102 if ((mark in repo.branchtags() or mark == repo.dirstate.branch())
102 and not force):
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 if rev:
106 if rev:
105 marks[mark] = repo.lookup(rev)
107 marks[mark] = repo.lookup(rev)
106 else:
108 else:
@@ -114,7 +116,8 b' def bookmark(ui, repo, mark=None, rev=No'
114 else:
116 else:
115 for bmark, n in marks.iteritems():
117 for bmark, n in marks.iteritems():
116 prefix = (n == cur) and '*' or ' '
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 return
121 return
119
122
120 def _revstostrip(changelog, node):
123 def _revstostrip(changelog, node):
@@ -192,7 +195,8 b' def reposetup(ui, repo):'
192 except RepoError, inst:
195 except RepoError, inst:
193 pass
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 if result > 1:
200 if result > 1:
197 # We have more heads than before
201 # We have more heads than before
198 return result
202 return result
General Comments 0
You need to be logged in to leave comments. Login now