##// END OF EJS Templates
bookmarks: prevent divergent bookmark from being updated unexpectedly...
FUJIWARA Katsunori -
r24353:3f6bf9f2 default
parent child Browse files
Show More
@@ -363,6 +363,11 b' def compare(repo, srcmarks, dstmarks,'
363 363 return results
364 364
365 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 371 if b == '@':
367 372 b = ''
368 373 # find a unique @ suffix
@@ -370,6 +375,8 b' def _diverge(ui, b, path, localmarks):'
370 375 n = '%s@%d' % (b, x)
371 376 if n not in localmarks:
372 377 break
378 else:
379 n = None
373 380 # try to use an @pathalias suffix
374 381 # if an @pathalias already exists, we overwrite (update) it
375 382 if path.startswith("file:"):
@@ -411,9 +418,13 b' def updatefromremote(ui, repo, remotemar'
411 418 _("importing bookmark %s\n") % (b)))
412 419 else:
413 420 db = _diverge(ui, b, path, localmarks)
414 changed.append((db, bin(scid), warn,
415 _("divergent bookmark %s stored as %s\n")
416 % (b, db)))
421 if db:
422 changed.append((db, bin(scid), warn,
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 428 for b, scid, dcid in adddst + advdst:
418 429 if b in explicit:
419 430 explicit.discard(b)
@@ -164,6 +164,27 b' divergent bookmarks'
164 164 Z 2:0d2164f0ce0d
165 165 foo -1:000000000000
166 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 188 $ hg push -f ../a
168 189 pushing to ../a
169 190 searching for changes
General Comments 0
You need to be logged in to leave comments. Login now