Mercurial > hg
comparison mercurial/bookmarks.py @ 17770:6c81b8ebf66e
bookmarks: when @ bookmark diverges, don't double the @ sign (BC)
This changeset treats the bookmark "@" as a special case for the naming of
divergent bookmarks, as per the tables below. For the <no alias> case, the
actual suffix will vary, depending on what suffixes are already in use.
Before:
Bookmark | Remote | Divergent Bookmark
--------------------------------------
foo | bar | foo@bar
foo | <no alias> | foo@1
@ | bar | @@bar
@ | <no alias> | @@1
After:
Bookmark | Remote | Divergent Bookmark
--------------------------------------
foo | bar | foo@bar
foo | <no alias> | foo@1
@ | bar | @bar
@ | <no alias> | @1
This case is likely to be more common now that 92980a8dfdfe has made the "@"
bookmark have special meaning to clone.
The change in behavior was discussed on the mailing list in the thread below:
http://markmail.org/thread/rwedgxp7le5j2h2f
author | David M. Carr <david@carrclan.us> |
---|---|
date | Mon, 15 Oct 2012 23:54:54 -0400 |
parents | b8424c92ba2b |
children | be1467342038 |
comparison
equal
deleted
inserted
replaced
17769:8672e615d81c | 17770:6c81b8ebf66e |
---|---|
212 if validdest(repo, cl, cr): | 212 if validdest(repo, cl, cr): |
213 repo._bookmarks[k] = cr.node() | 213 repo._bookmarks[k] = cr.node() |
214 changed = True | 214 changed = True |
215 ui.status(_("updating bookmark %s\n") % k) | 215 ui.status(_("updating bookmark %s\n") % k) |
216 else: | 216 else: |
217 if k == '@': | |
218 kd = '' | |
219 else: | |
220 kd = k | |
217 # find a unique @ suffix | 221 # find a unique @ suffix |
218 for x in range(1, 100): | 222 for x in range(1, 100): |
219 n = '%s@%d' % (k, x) | 223 n = '%s@%d' % (kd, x) |
220 if n not in repo._bookmarks: | 224 if n not in repo._bookmarks: |
221 break | 225 break |
222 # try to use an @pathalias suffix | 226 # try to use an @pathalias suffix |
223 # if an @pathalias already exists, we overwrite (update) it | 227 # if an @pathalias already exists, we overwrite (update) it |
224 for p, u in ui.configitems("paths"): | 228 for p, u in ui.configitems("paths"): |
225 if path == u: | 229 if path == u: |
226 n = '%s@%s' % (k, p) | 230 n = '%s@%s' % (kd, p) |
227 | 231 |
228 repo._bookmarks[n] = cr.node() | 232 repo._bookmarks[n] = cr.node() |
229 changed = True | 233 changed = True |
230 ui.warn(_("divergent bookmark %s stored as %s\n") % (k, n)) | 234 ui.warn(_("divergent bookmark %s stored as %s\n") % (k, n)) |
231 elif rb[k] in repo: | 235 elif rb[k] in repo: |