Mercurial > hgsubversion
comparison hgsubversion/wrappers.py @ 1516:fbc22592f4fa
push: lock repo before calling createmarkers
Previously, when devel.all-warnings is set to True, hg subversion will crash
when pushing with the error:
ProgrammingError: transaction requires locking
Tracking that down, that is because "createmarkers" was called without
locking.
A comprehensive test was added to run test_push_command with obsstore turned
on to cover the code paths.
author | Jun Wu <quark@fb.com> |
---|---|
date | Mon, 07 Aug 2017 18:12:16 -0700 |
parents | 07c38eee3954 |
children | aec176db232c |
comparison
equal
deleted
inserted
replaced
1515:106716ed2ed0 | 1516:fbc22592f4fa |
---|---|
349 try: | 349 try: |
350 hg.update(repo, repo.branchtip(workingbranch)) | 350 hg.update(repo, repo.branchtip(workingbranch)) |
351 finally: | 351 finally: |
352 util.swap_out_encoding() | 352 util.swap_out_encoding() |
353 | 353 |
354 if hasobsolete: | 354 with repo.lock(): |
355 for marker in obsmarkers: | 355 if hasobsolete: |
356 obsolete.createmarkers(repo, marker) | 356 for marker in obsmarkers: |
357 beforepush = marker[0][0] | 357 obsolete.createmarkers(repo, marker) |
358 afterpush = marker[0][1][0] | 358 beforepush = marker[0][0] |
359 ui.note('marking %s as obsoleted by %s\n' % | 359 afterpush = marker[0][1][0] |
360 (beforepush.hex(), afterpush.hex())) | 360 ui.note('marking %s as obsoleted by %s\n' % |
361 else: | 361 (beforepush.hex(), afterpush.hex())) |
362 # strip the original changesets since the push was | 362 else: |
363 # successful and changeset obsolescence is unavailable | 363 # strip the original changesets since the push was |
364 util.strip(ui, repo, outgoing, "all") | 364 # successful and changeset obsolescence is unavailable |
365 util.strip(ui, repo, outgoing, "all") | |
365 finally: | 366 finally: |
366 try: | 367 try: |
367 # It's always safe to delete the temporary commits. | 368 # It's always safe to delete the temporary commits. |
368 # The originals are not deleted unless the push | 369 # The originals are not deleted unless the push |
369 # completely succeeded. | 370 # completely succeeded. |
371 # If the repo is on a temporary commit, get off before | 372 # If the repo is on a temporary commit, get off before |
372 # the strip. | 373 # the strip. |
373 parent = repo[None].p1() | 374 parent = repo[None].p1() |
374 if parent.node() in temporary_commits: | 375 if parent.node() in temporary_commits: |
375 hg.update(repo, parent.p1().node()) | 376 hg.update(repo, parent.p1().node()) |
376 if hasobsolete: | 377 with repo.lock(): |
377 relations = ((repo[n], ()) for n in temporary_commits) | 378 if hasobsolete: |
378 obsolete.createmarkers(repo, relations) | 379 relations = ((repo[n], ()) for n in temporary_commits) |
379 else: | 380 obsolete.createmarkers(repo, relations) |
380 util.strip(ui, repo, temporary_commits, backup=None) | 381 else: |
382 util.strip(ui, repo, temporary_commits, backup=None) | |
381 | 383 |
382 finally: | 384 finally: |
383 util.swap_out_encoding(old_encoding) | 385 util.swap_out_encoding(old_encoding) |
384 return 1 # so we get a sane exit status, see hg's commands.push | 386 return 1 # so we get a sane exit status, see hg's commands.push |
385 | 387 |