Show More
@@ -6,7 +6,7 b'' | |||
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | 8 | from mercurial.i18n import _ |
|
9 | from mercurial.node import hex | |
|
9 | from mercurial.node import hex, bin | |
|
10 | 10 | from mercurial import encoding, error, util, obsolete |
|
11 | 11 | import errno |
|
12 | 12 | |
@@ -325,48 +325,43 b' def compare(repo, srcmarks, dstmarks,' | |||
|
325 | 325 | |
|
326 | 326 | return results |
|
327 | 327 | |
|
328 | def updatefromremote(ui, repo, remotemarks, path): | |
|
329 | ui.debug("checking for updated bookmarks\n") | |
|
330 | changed = False | |
|
331 | localmarks = repo._bookmarks | |
|
332 | for k in sorted(remotemarks): | |
|
333 | if k in localmarks: | |
|
334 | nr, nl = remotemarks[k], localmarks[k] | |
|
335 | if nr in repo: | |
|
336 | cr = repo[nr] | |
|
337 | cl = repo[nl] | |
|
338 | if cl.rev() >= cr.rev(): | |
|
339 | continue | |
|
340 | if validdest(repo, cl, cr): | |
|
341 | localmarks[k] = cr.node() | |
|
342 | changed = True | |
|
343 | ui.status(_("updating bookmark %s\n") % k) | |
|
344 | else: | |
|
345 | if k == '@': | |
|
346 | kd = '' | |
|
347 | else: | |
|
348 | kd = k | |
|
328 | def _diverge(ui, b, path, localmarks): | |
|
329 | if b == '@': | |
|
330 | b = '' | |
|
349 | 331 |
|
|
350 | 332 |
|
|
351 |
|
|
|
333 | n = '%s@%d' % (b, x) | |
|
352 | 334 |
|
|
353 | 335 |
|
|
354 | 336 |
|
|
355 | 337 |
|
|
356 | 338 |
|
|
357 | 339 |
|
|
358 |
|
|
|
340 | n = '%s@%s' % (b, p) | |
|
341 | return n | |
|
342 | ||
|
343 | def updatefromremote(ui, repo, remotemarks, path): | |
|
344 | ui.debug("checking for updated bookmarks\n") | |
|
345 | localmarks = repo._bookmarks | |
|
346 | (addsrc, adddst, advsrc, advdst, diverge, differ, invalid | |
|
347 | ) = compare(repo, remotemarks, localmarks, dsthex=hex) | |
|
359 | 348 | |
|
360 | localmarks[n] = cr.node() | |
|
361 | changed = True | |
|
362 | ui.warn(_("divergent bookmark %s stored as %s\n") % (k, n)) | |
|
363 | elif remotemarks[k] in repo: | |
|
364 | # add remote bookmarks for changes we already have | |
|
365 | localmarks[k] = repo[remotemarks[k]].node() | |
|
366 | changed = True | |
|
367 |
|
|
|
368 | ||
|
349 | changed = [] | |
|
350 | for b, scid, dcid in addsrc: | |
|
351 | if scid in repo: # add remote bookmarks for changes we already have | |
|
352 | changed.append((b, bin(scid), ui.status, | |
|
353 | _("adding remote bookmark %s\n") % (b))) | |
|
354 | for b, scid, dcid in advsrc: | |
|
355 | changed.append((b, bin(scid), ui.status, | |
|
356 | _("updating bookmark %s\n") % (b))) | |
|
357 | for b, scid, dcid in diverge: | |
|
358 | db = _diverge(ui, b, path, localmarks) | |
|
359 | changed.append((db, bin(scid), ui.warn, | |
|
360 | _("divergent bookmark %s stored as %s\n") % (b, db))) | |
|
369 | 361 | if changed: |
|
362 | for b, node, writer, msg in sorted(changed): | |
|
363 | localmarks[b] = node | |
|
364 | writer(msg) | |
|
370 | 365 | localmarks.write() |
|
371 | 366 | |
|
372 | 367 | def diff(ui, dst, src): |
General Comments 0
You need to be logged in to leave comments.
Login now