comparison hgext/bookmarks.py @ 7255:69e431ea124d

bookmarks: Rename --move to --rename To me, --move sounds like "make an existing bookmark refer to another revision", but --move currently means "rename an existing bookmark". This patch renames the switch to --rename to make it easier to understand.
author Joel Rosdahl <joel@rosdahl.net>
date Sat, 25 Oct 2008 19:05:52 +0200
parents d892211d670e
children df800e004077
comparison
equal deleted inserted replaced
7254:d892211d670e 7255:69e431ea124d
57 file = repo.opener('bookmarks', 'w+') 57 file = repo.opener('bookmarks', 'w+')
58 for refspec, node in refs.items(): 58 for refspec, node in refs.items():
59 file.write("%s %s\n" % (hex(node), refspec)) 59 file.write("%s %s\n" % (hex(node), refspec))
60 file.close() 60 file.close()
61 61
62 def bookmark(ui, repo, mark=None, rev=None, force=False, delete=False, move=None): 62 def bookmark(ui, repo, mark=None, rev=None, force=False, delete=False, rename=None):
63 '''mercurial bookmarks 63 '''mercurial bookmarks
64 64
65 Bookmarks are pointers to certain commits that move when 65 Bookmarks are pointers to certain commits that move when
66 commiting. Bookmarks are local. They can be renamed, copied and 66 commiting. Bookmarks are local. They can be renamed, copied and
67 deleted. It is possible to use bookmark names in 'hg merge' and 'hg 67 deleted. It is possible to use bookmark names in 'hg merge' and 'hg
74 ''' 74 '''
75 hexfn = ui.debugflag and hex or short 75 hexfn = ui.debugflag and hex or short
76 marks = parse(repo) 76 marks = parse(repo)
77 cur = repo.changectx('.').node() 77 cur = repo.changectx('.').node()
78 78
79 if move: 79 if rename:
80 if move not in marks: 80 if rename not in marks:
81 raise util.Abort(_("a bookmark of this name does not exist")) 81 raise util.Abort(_("a bookmark of this name does not exist"))
82 if mark in marks and not force: 82 if mark in marks and not force:
83 raise util.Abort(_("a bookmark of the same name already exists")) 83 raise util.Abort(_("a bookmark of the same name already exists"))
84 if mark is None: 84 if mark is None:
85 raise util.Abort(_("new bookmark name required")) 85 raise util.Abort(_("new bookmark name required"))
86 marks[mark] = marks[move] 86 marks[mark] = marks[rename]
87 del marks[move] 87 del marks[rename]
88 write(repo, marks) 88 write(repo, marks)
89 return 89 return
90 90
91 if delete: 91 if delete:
92 if mark == None: 92 if mark == None:
220 "bookmarks": 220 "bookmarks":
221 (bookmark, 221 (bookmark,
222 [('f', 'force', False, _('force')), 222 [('f', 'force', False, _('force')),
223 ('r', 'rev', '', _('revision')), 223 ('r', 'rev', '', _('revision')),
224 ('d', 'delete', False, _('delete a given bookmark')), 224 ('d', 'delete', False, _('delete a given bookmark')),
225 ('m', 'move', '', _('move a given bookmark'))], 225 ('m', 'rename', '', _('rename a given bookmark'))],
226 _('hg bookmarks [-d] [-m NAME] [-r NAME] [NAME]')), 226 _('hg bookmarks [-d] [-m NAME] [-r NAME] [NAME]')),
227 } 227 }