Show More
@@ -3665,16 +3665,23 b' def tag(ui, repo, name1, *names, **opts)' | |||||
3665 |
|
3665 | |||
3666 | Tags are used to name particular revisions of the repository and are |
|
3666 | Tags are used to name particular revisions of the repository and are | |
3667 | very useful to compare different revisions, to go back to significant |
|
3667 | very useful to compare different revisions, to go back to significant | |
3668 | earlier versions or to mark branch points as releases, etc. |
|
3668 | earlier versions or to mark branch points as releases, etc. Changing | |
|
3669 | an existing tag is normally disallowed; use -f/--force to override. | |||
3669 |
|
3670 | |||
3670 | If no revision is given, the parent of the working directory is |
|
3671 | If no revision is given, the parent of the working directory is | |
3671 | used, or tip if no revision is checked out. |
|
3672 | used, or tip if no revision is checked out. | |
3672 |
|
3673 | |||
3673 | To facilitate version control, distribution, and merging of tags, |
|
3674 | To facilitate version control, distribution, and merging of tags, | |
3674 | they are stored as a file named ".hgtags" which is managed |
|
3675 | they are stored as a file named ".hgtags" which is managed similarly | |
3675 |
|
|
3676 | to other project files and can be hand-edited if necessary. This | |
3676 | necessary. The file '.hg/localtags' is used for local tags (not |
|
3677 | also means that tagging creates a new commit. The file | |
3677 | shared among repositories). |
|
3678 | ".hg/localtags" is used for local tags (not shared among | |
|
3679 | repositories). | |||
|
3680 | ||||
|
3681 | Tag commits are usually made at the head of a branch. If the parent | |||
|
3682 | of the working directory is not a branch head, :hg:`tag` aborts; use | |||
|
3683 | -f/--force to force the tag commit to be based on a non-head | |||
|
3684 | changeset. | |||
3678 |
|
3685 | |||
3679 | See :hg:`help dates` for a list of formats valid for -d/--date. |
|
3686 | See :hg:`help dates` for a list of formats valid for -d/--date. | |
3680 |
|
3687 | |||
@@ -3717,9 +3724,13 b' def tag(ui, repo, name1, *names, **opts)' | |||||
3717 | if n in repo.tags(): |
|
3724 | if n in repo.tags(): | |
3718 | raise util.Abort(_('tag \'%s\' already exists ' |
|
3725 | raise util.Abort(_('tag \'%s\' already exists ' | |
3719 | '(use -f to force)') % n) |
|
3726 | '(use -f to force)') % n) | |
3720 | if not rev_ and repo.dirstate.parents()[1] != nullid: |
|
3727 | if not opts.get('local'): | |
3721 | raise util.Abort(_('uncommitted merge - please provide a ' |
|
3728 | p1, p2 = repo.dirstate.parents() | |
3722 | 'specific revision')) |
|
3729 | if p2 != nullid: | |
|
3730 | raise util.Abort(_('uncommitted merge')) | |||
|
3731 | bheads = repo.branchheads() | |||
|
3732 | if not opts.get('force') and bheads and p1 not in bheads: | |||
|
3733 | raise util.Abort(_('not at a branch head (use -f to force)')) | |||
3723 | r = cmdutil.revsingle(repo, rev_).node() |
|
3734 | r = cmdutil.revsingle(repo, rev_).node() | |
3724 |
|
3735 | |||
3725 | if not message: |
|
3736 | if not message: | |
@@ -4481,7 +4492,7 b' table = {' | |||||
4481 | _('[OPTION]... [FILE]...')), |
|
4492 | _('[OPTION]... [FILE]...')), | |
4482 | "tag": |
|
4493 | "tag": | |
4483 | (tag, |
|
4494 | (tag, | |
4484 |
[('f', 'force', None, _('r |
|
4495 | [('f', 'force', None, _('force tag')), | |
4485 | ('l', 'local', None, _('make the tag local')), |
|
4496 | ('l', 'local', None, _('make the tag local')), | |
4486 | ('r', 'rev', '', |
|
4497 | ('r', 'rev', '', | |
4487 | _('revision to tag'), _('REV')), |
|
4498 | _('revision to tag'), _('REV')), |
@@ -308,10 +308,11 b' class localrepository(repo.repository):' | |||||
308 |
|
308 | |||
309 | date: date tuple to use if committing''' |
|
309 | date: date tuple to use if committing''' | |
310 |
|
310 | |||
311 | for x in self.status()[:5]: |
|
311 | if not local: | |
312 | if '.hgtags' in x: |
|
312 | for x in self.status()[:5]: | |
313 | raise util.Abort(_('working copy of .hgtags is changed ' |
|
313 | if '.hgtags' in x: | |
314 | '(please commit .hgtags manually)')) |
|
314 | raise util.Abort(_('working copy of .hgtags is changed ' | |
|
315 | '(please commit .hgtags manually)')) | |||
315 |
|
316 | |||
316 | self.tags() # instantiate the cache |
|
317 | self.tags() # instantiate the cache | |
317 | self._tag(names, node, message, local, user, date) |
|
318 | self._tag(names, node, message, local, user, date) |
@@ -9,7 +9,7 b'' | |||||
9 |
|
9 | |||
10 | $ hg co 1 |
|
10 | $ hg co 1 | |
11 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
11 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
12 | $ hg tag -r0 t1 |
|
12 | $ hg tag -f -r0 t1 | |
13 | $ hg tags |
|
13 | $ hg tags | |
14 | tip 3:a49829c4fc11 |
|
14 | tip 3:a49829c4fc11 | |
15 | t1 0:f7b1eb17ad24 |
|
15 | t1 0:f7b1eb17ad24 |
@@ -78,13 +78,20 b'' | |||||
78 | $ cat .hg/localtags |
|
78 | $ cat .hg/localtags | |
79 | d4f0d2909abc9290e2773c08837d70c1794e3f5a bleah1 |
|
79 | d4f0d2909abc9290e2773c08837d70c1794e3f5a bleah1 | |
80 |
|
80 | |||
|
81 | tagging on a non-head revision | |||
|
82 | ||||
81 | $ hg update 0 |
|
83 | $ hg update 0 | |
82 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
84 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
|
85 | $ hg tag -l localblah | |||
83 | $ hg tag "foobar" |
|
86 | $ hg tag "foobar" | |
|
87 | abort: not at a branch head (use -f to force) | |||
|
88 | [255] | |||
|
89 | $ hg tag -f "foobar" | |||
84 | $ cat .hgtags |
|
90 | $ cat .hgtags | |
85 | acb14030fe0a21b60322c440ad2d20cf7685a376 foobar |
|
91 | acb14030fe0a21b60322c440ad2d20cf7685a376 foobar | |
86 | $ cat .hg/localtags |
|
92 | $ cat .hg/localtags | |
87 | d4f0d2909abc9290e2773c08837d70c1794e3f5a bleah1 |
|
93 | d4f0d2909abc9290e2773c08837d70c1794e3f5a bleah1 | |
|
94 | acb14030fe0a21b60322c440ad2d20cf7685a376 localblah | |||
88 |
|
95 | |||
89 | $ hg tag -l 'xx |
|
96 | $ hg tag -l 'xx | |
90 | > newline' |
|
97 | > newline' | |
@@ -102,6 +109,7 b' cloning local tags' | |||||
102 | tag: bleah |
|
109 | tag: bleah | |
103 | tag: bleah0 |
|
110 | tag: bleah0 | |
104 | tag: foobar |
|
111 | tag: foobar | |
|
112 | tag: localblah | |||
105 | user: test |
|
113 | user: test | |
106 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
114 | date: Thu Jan 01 00:00:00 1970 +0000 | |
107 | summary: test |
|
115 | summary: test | |
@@ -156,10 +164,10 b" doesn't end with EOL" | |||||
156 | > f = file('.hg/localtags', 'w'); f.write(last); f.close() |
|
164 | > f = file('.hg/localtags', 'w'); f.write(last); f.close() | |
157 | > EOF |
|
165 | > EOF | |
158 | $ cat .hg/localtags; echo |
|
166 | $ cat .hg/localtags; echo | |
159 | d4f0d2909abc9290e2773c08837d70c1794e3f5a bleah1 |
|
167 | acb14030fe0a21b60322c440ad2d20cf7685a376 localblah | |
160 | $ hg tag -l localnewline |
|
168 | $ hg tag -l localnewline | |
161 | $ cat .hg/localtags; echo |
|
169 | $ cat .hg/localtags; echo | |
162 | d4f0d2909abc9290e2773c08837d70c1794e3f5a bleah1 |
|
170 | acb14030fe0a21b60322c440ad2d20cf7685a376 localblah | |
163 | c2899151f4e76890c602a2597a650a72666681bf localnewline |
|
171 | c2899151f4e76890c602a2597a650a72666681bf localnewline | |
164 |
|
172 | |||
165 |
|
173 | |||
@@ -196,3 +204,75 b' test custom commit messages' | |||||
196 | $ hg log -l1 --template "{desc}\n" |
|
204 | $ hg log -l1 --template "{desc}\n" | |
197 | custom tag message |
|
205 | custom tag message | |
198 | second line |
|
206 | second line | |
|
207 | ||||
|
208 | ||||
|
209 | local tag with .hgtags modified | |||
|
210 | ||||
|
211 | $ hg tag hgtags-modified | |||
|
212 | $ hg rollback | |||
|
213 | rolling back to revision 11 (undo commit) | |||
|
214 | $ hg st | |||
|
215 | M .hgtags | |||
|
216 | ? .hgtags.orig | |||
|
217 | ? editor | |||
|
218 | $ hg tag --local baz | |||
|
219 | $ hg revert --no-backup .hgtags | |||
|
220 | ||||
|
221 | ||||
|
222 | tagging when at named-branch-head that's not a topo-head | |||
|
223 | ||||
|
224 | $ hg up default | |||
|
225 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
226 | $ hg merge -t internal:local | |||
|
227 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |||
|
228 | (branch merge, don't forget to commit) | |||
|
229 | $ hg ci -m 'merge named branch' | |||
|
230 | $ hg up 11 | |||
|
231 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
232 | $ hg tag new-topo-head | |||
|
233 | ||||
|
234 | ||||
|
235 | tagging on null rev | |||
|
236 | ||||
|
237 | $ hg up null | |||
|
238 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |||
|
239 | $ hg tag nullrev | |||
|
240 | abort: not at a branch head (use -f to force) | |||
|
241 | [255] | |||
|
242 | ||||
|
243 | $ hg init empty | |||
|
244 | $ hg tag -R empty nullrev | |||
|
245 | ||||
|
246 | $ cd .. | |||
|
247 | ||||
|
248 | tagging on an uncommitted merge (issue2542) | |||
|
249 | ||||
|
250 | $ hg init repo-tag-uncommitted-merge | |||
|
251 | $ cd repo-tag-uncommitted-merge | |||
|
252 | $ echo c1 > f1 | |||
|
253 | $ hg ci -Am0 | |||
|
254 | adding f1 | |||
|
255 | $ hg branch b1 | |||
|
256 | marked working directory as branch b1 | |||
|
257 | $ echo c2 >> f1 | |||
|
258 | $ hg ci -m1 | |||
|
259 | $ hg up default | |||
|
260 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
261 | $ hg merge b1 | |||
|
262 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
263 | (branch merge, don't forget to commit) | |||
|
264 | ||||
|
265 | $ hg tag t1 | |||
|
266 | abort: uncommitted merge | |||
|
267 | [255] | |||
|
268 | $ hg status | |||
|
269 | M f1 | |||
|
270 | $ hg tag --rev 1 t2 | |||
|
271 | abort: uncommitted merge | |||
|
272 | [255] | |||
|
273 | $ hg tag --rev 1 --local t3 | |||
|
274 | $ hg tags -v | |||
|
275 | tip 1:9466ada9ee90 | |||
|
276 | t3 1:9466ada9ee90 local | |||
|
277 | ||||
|
278 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now