Show More
@@ -363,6 +363,11 b' def compare(repo, srcmarks, dstmarks,' | |||||
363 | return results |
|
363 | return results | |
364 |
|
364 | |||
365 | def _diverge(ui, b, path, localmarks): |
|
365 | def _diverge(ui, b, path, localmarks): | |
|
366 | '''Return appropriate diverged bookmark for specified ``path`` | |||
|
367 | ||||
|
368 | This returns None, if it is failed to assign any divergent | |||
|
369 | bookmark name. | |||
|
370 | ''' | |||
366 | if b == '@': |
|
371 | if b == '@': | |
367 | b = '' |
|
372 | b = '' | |
368 | # find a unique @ suffix |
|
373 | # find a unique @ suffix | |
@@ -370,6 +375,8 b' def _diverge(ui, b, path, localmarks):' | |||||
370 | n = '%s@%d' % (b, x) |
|
375 | n = '%s@%d' % (b, x) | |
371 | if n not in localmarks: |
|
376 | if n not in localmarks: | |
372 | break |
|
377 | break | |
|
378 | else: | |||
|
379 | n = None | |||
373 | # try to use an @pathalias suffix |
|
380 | # try to use an @pathalias suffix | |
374 | # if an @pathalias already exists, we overwrite (update) it |
|
381 | # if an @pathalias already exists, we overwrite (update) it | |
375 | if path.startswith("file:"): |
|
382 | if path.startswith("file:"): | |
@@ -411,9 +418,13 b' def updatefromremote(ui, repo, remotemar' | |||||
411 | _("importing bookmark %s\n") % (b))) |
|
418 | _("importing bookmark %s\n") % (b))) | |
412 | else: |
|
419 | else: | |
413 | db = _diverge(ui, b, path, localmarks) |
|
420 | db = _diverge(ui, b, path, localmarks) | |
414 | changed.append((db, bin(scid), warn, |
|
421 | if db: | |
415 | _("divergent bookmark %s stored as %s\n") |
|
422 | changed.append((db, bin(scid), warn, | |
416 | % (b, db))) |
|
423 | _("divergent bookmark %s stored as %s\n") % | |
|
424 | (b, db))) | |||
|
425 | else: | |||
|
426 | warn(_("warning: failed to assign numbered name " | |||
|
427 | "to divergent bookmark %s\n") % (b)) | |||
417 | for b, scid, dcid in adddst + advdst: |
|
428 | for b, scid, dcid in adddst + advdst: | |
418 | if b in explicit: |
|
429 | if b in explicit: | |
419 | explicit.discard(b) |
|
430 | explicit.discard(b) |
@@ -164,6 +164,27 b' divergent bookmarks' | |||||
164 | Z 2:0d2164f0ce0d |
|
164 | Z 2:0d2164f0ce0d | |
165 | foo -1:000000000000 |
|
165 | foo -1:000000000000 | |
166 | * foobar 1:9b140be10808 |
|
166 | * foobar 1:9b140be10808 | |
|
167 | ||||
|
168 | (test that too many divergence of bookmark) | |||
|
169 | ||||
|
170 | $ cat > $TESTTMP/seq.py <<EOF | |||
|
171 | > import sys | |||
|
172 | > for i in xrange(*[int(a) for a in sys.argv[1:]]): | |||
|
173 | > print i | |||
|
174 | > EOF | |||
|
175 | $ python $TESTTMP/seq.py 1 100 | while read i; do hg bookmarks -r 000000000000 "X@${i}"; done | |||
|
176 | $ hg pull ../a | |||
|
177 | pulling from ../a | |||
|
178 | searching for changes | |||
|
179 | no changes found | |||
|
180 | warning: failed to assign numbered name to divergent bookmark X | |||
|
181 | divergent bookmark @ stored as @1 | |||
|
182 | $ hg bookmarks | grep '^ X' | grep -v ':000000000000' | |||
|
183 | X 1:9b140be10808 | |||
|
184 | X@foo 2:0d2164f0ce0d | |||
|
185 | $ python $TESTTMP/seq.py 1 100 | while read i; do hg bookmarks -d "X@${i}"; done | |||
|
186 | $ hg bookmarks -d "@1" | |||
|
187 | ||||
167 | $ hg push -f ../a |
|
188 | $ hg push -f ../a | |
168 | pushing to ../a |
|
189 | pushing to ../a | |
169 | searching for changes |
|
190 | searching for changes |
General Comments 0
You need to be logged in to leave comments.
Login now