##// END OF EJS Templates
shelve: directly handle the initial parent alignment...
Boris Feld -
r38637:c829749e default
parent child Browse files
Show More
@@ -686,6 +686,10 b' def unshelvecontinue(ui, repo, state, op'
686 shelvectx = repo[state.parents[1]]
686 shelvectx = repo[state.parents[1]]
687 pendingctx = state.pendingctx
687 pendingctx = state.pendingctx
688
688
689 with repo.dirstate.parentchange():
690 repo.setparents(state.pendingctx.node(), nodemod.nullid)
691 repo.dirstate.write(repo.currenttransaction())
692
689 overrides = {('phases', 'new-commit'): phases.secret}
693 overrides = {('phases', 'new-commit'): phases.secret}
690 with repo.ui.configoverride(overrides, 'unshelve'):
694 with repo.ui.configoverride(overrides, 'unshelve'):
691 with repo.dirstate.parentchange():
695 with repo.dirstate.parentchange():
@@ -761,33 +765,46 b' def _rebaserestoredcommit(ui, repo, opts'
761 if tmpwctx.node() == shelvectx.parents()[0].node():
765 if tmpwctx.node() == shelvectx.parents()[0].node():
762 return shelvectx
766 return shelvectx
763
767
764 ui.status(_('rebasing shelved changes\n'))
768 overrides = {
765 try:
769 ('ui', 'forcemerge'): opts.get('tool', ''),
766 rebase.rebase(ui, repo, **{
770 ('phases', 'new-commit'): phases.secret,
767 r'rev': [shelvectx.rev()],
771 }
768 r'dest': "%d" % tmpwctx.rev(),
772 with repo.ui.configoverride(overrides, 'unshelve'):
769 r'keep': True,
773 ui.status(_('rebasing shelved changes\n'))
770 r'tool': opts.get('tool', ''),
774 stats = merge.graft(repo, shelvectx, shelvectx.p1(),
771 })
775 labels=['dest', 'source'],
772 except error.InterventionRequired:
776 keepconflictparent=True)
773 tr.close()
777 if stats.unresolvedcount:
778 tr.close()
779
780 nodestoremove = [repo.changelog.node(rev)
781 for rev in xrange(oldtiprev, len(repo))]
782 shelvedstate.save(repo, basename, pctx, tmpwctx, nodestoremove,
783 branchtorestore, opts.get('keep'), activebookmark)
784 raise error.InterventionRequired(
785 _("unresolved conflicts (see 'hg resolve', then "
786 "'hg unshelve --continue')"))
774
787
775 nodestoremove = [repo.changelog.node(rev)
788 with repo.dirstate.parentchange():
776 for rev in xrange(oldtiprev, len(repo))]
789 repo.setparents(tmpwctx.node(), nodemod.nullid)
777 shelvedstate.save(repo, basename, pctx, tmpwctx, nodestoremove,
790 newnode = repo.commit(text=shelvectx.description(),
778 branchtorestore, opts.get('keep'), activebookmark)
791 extra=shelvectx.extra(),
792 user=shelvectx.user(),
793 date=shelvectx.date())
779
794
780 repo.vfs.rename('rebasestate', 'unshelverebasestate')
795 if newnode is None:
781 raise error.InterventionRequired(
796 # If it ended up being a no-op commit, then the normal
782 _("unresolved conflicts (see 'hg resolve', then "
797 # merge state clean-up path doesn't happen, so do it
783 "'hg unshelve --continue')"))
798 # here. Fix issue5494
799 merge.mergestate.clean(repo)
800 shelvectx = tmpwctx
801 msg = _('note: unshelved changes already existed '
802 'in the working copy\n')
803 ui.status(msg)
804 else:
805 shelvectx = repo[newnode]
806 hg.updaterepo(repo, tmpwctx.node(), False)
784
807
785 # refresh ctx after rebase completes
786 shelvectx = repo['tip']
787
788 if tmpwctx not in shelvectx.parents():
789 # rebase was a no-op, so it produced no child commit
790 shelvectx = tmpwctx
791 return shelvectx
808 return shelvectx
792
809
793 def _forgetunknownfiles(repo, shelvectx, addedbefore):
810 def _forgetunknownfiles(repo, shelvectx, addedbefore):
@@ -583,7 +583,6 b' Test shelve/unshelve'
583 $ hg unshelve
583 $ hg unshelve
584 unshelving change 'default'
584 unshelving change 'default'
585 rebasing shelved changes
585 rebasing shelved changes
586 rebasing 2:45f63161acea "changes to: initial" (tip)
587 merging b and a to b
586 merging b and a to b
588 $ ls
587 $ ls
589 b
588 b
@@ -213,7 +213,6 b' local edits should not prevent a shelved'
213 unshelving change 'default-01'
213 unshelving change 'default-01'
214 temporarily committing pending changes (restore with 'hg unshelve --abort')
214 temporarily committing pending changes (restore with 'hg unshelve --abort')
215 rebasing shelved changes
215 rebasing shelved changes
216 rebasing 4:32c69314e062 "changes to: [mq]: second.patch" (tip)
217 merging a/a
216 merging a/a
218
217
219 $ hg revert --all -q
218 $ hg revert --all -q
@@ -335,7 +334,6 b' force a conflicted merge to occur'
335 unshelving change 'default'
334 unshelving change 'default'
336 temporarily committing pending changes (restore with 'hg unshelve --abort')
335 temporarily committing pending changes (restore with 'hg unshelve --abort')
337 rebasing shelved changes
336 rebasing shelved changes
338 rebasing 5:32c69314e062 "changes to: [mq]: second.patch" (tip)
339 merging a/a
337 merging a/a
340 warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark')
338 warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark')
341 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
339 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
@@ -529,7 +527,6 b' if we resolve a conflict while unshelvin'
529 unshelving change 'default'
527 unshelving change 'default'
530 temporarily committing pending changes (restore with 'hg unshelve --abort')
528 temporarily committing pending changes (restore with 'hg unshelve --abort')
531 rebasing shelved changes
529 rebasing shelved changes
532 rebasing 6:2f694dd83a13 "changes to: second" (tip)
533 merging a/a
530 merging a/a
534 $ hg parents -q
531 $ hg parents -q
535 4:33f7f61e6c5e
532 4:33f7f61e6c5e
@@ -552,9 +549,8 b' if we resolve a conflict while unshelvin'
552 unshelving change 'default'
549 unshelving change 'default'
553 temporarily committing pending changes (restore with 'hg unshelve --abort')
550 temporarily committing pending changes (restore with 'hg unshelve --abort')
554 rebasing shelved changes
551 rebasing shelved changes
555 rebasing 6:2f694dd83a13 "changes to: second" (tip)
556 merging a/a
552 merging a/a
557 note: rebase of 6:2f694dd83a13 created no changes to commit
553 note: unshelved changes already existed in the working copy
558 $ hg parents -q
554 $ hg parents -q
559 4:33f7f61e6c5e
555 4:33f7f61e6c5e
560 $ hg shelve -l
556 $ hg shelve -l
@@ -643,7 +639,6 b' shelve should leave dirstate clean (issu'
643 $ hg unshelve
639 $ hg unshelve
644 unshelving change 'default'
640 unshelving change 'default'
645 rebasing shelved changes
641 rebasing shelved changes
646 rebasing 4:82a0d7d6ba61 "changes to: xyz" (tip)
647 $ hg status
642 $ hg status
648 M z
643 M z
649
644
@@ -670,7 +665,6 b' shelve should only unshelve pending chan'
670 $ hg unshelve
665 $ hg unshelve
671 unshelving change 'default'
666 unshelving change 'default'
672 rebasing shelved changes
667 rebasing shelved changes
673 rebasing 3:958bcbd1776e "changes to: c" (tip)
674 $ hg status
668 $ hg status
675 A d
669 A d
676
670
@@ -684,7 +678,6 b' unshelve should work on an ancestor of t'
684 $ hg unshelve
678 $ hg unshelve
685 unshelving change 'default'
679 unshelving change 'default'
686 rebasing shelved changes
680 rebasing shelved changes
687 rebasing 3:013284d9655e "changes to: b" (tip)
688 $ hg status
681 $ hg status
689 A d
682 A d
690
683
@@ -786,7 +779,6 b' unshelve and conflicts with tracked and '
786 unshelving change 'default'
779 unshelving change 'default'
787 temporarily committing pending changes (restore with 'hg unshelve --abort')
780 temporarily committing pending changes (restore with 'hg unshelve --abort')
788 rebasing shelved changes
781 rebasing shelved changes
789 rebasing 5:81152db69da7 "changes to: commit stuff" (tip)
790 merging f
782 merging f
791 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
783 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
792 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
784 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
@@ -825,7 +817,6 b' unshelve and conflicts with tracked and '
825 unshelving change 'default'
817 unshelving change 'default'
826 temporarily committing pending changes (restore with 'hg unshelve --abort')
818 temporarily committing pending changes (restore with 'hg unshelve --abort')
827 rebasing shelved changes
819 rebasing shelved changes
828 rebasing 5:81152db69da7 "changes to: commit stuff" (tip)
829 $ hg st
820 $ hg st
830 M a
821 M a
831 A f
822 A f
@@ -841,7 +832,6 b' unshelve and conflicts with tracked and '
841 $ hg unshelve
832 $ hg unshelve
842 unshelving change 'default'
833 unshelving change 'default'
843 rebasing shelved changes
834 rebasing shelved changes
844 rebasing 5:81152db69da7 "changes to: commit stuff" (tip)
845 merging f
835 merging f
846 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
836 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
847 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
837 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
@@ -883,7 +873,6 b' Recreate some conflict again'
883 $ hg unshelve
873 $ hg unshelve
884 unshelving change 'default'
874 unshelving change 'default'
885 rebasing shelved changes
875 rebasing shelved changes
886 rebasing 5:e42a7da90865 "changes to: second" (tip)
887 merging a/a
876 merging a/a
888 warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark')
877 warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark')
889 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
878 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
@@ -993,7 +982,6 b' Test interactive shelve'
993 unshelving change 'test'
982 unshelving change 'test'
994 temporarily committing pending changes (restore with 'hg unshelve --abort')
983 temporarily committing pending changes (restore with 'hg unshelve --abort')
995 rebasing shelved changes
984 rebasing shelved changes
996 rebasing 6:96a1354f65f6 "changes to: create conflict" (tip)
997 merging a/a
985 merging a/a
998 $ hg bookmark
986 $ hg bookmark
999 * test 4:33f7f61e6c5e
987 * test 4:33f7f61e6c5e
@@ -1170,13 +1158,12 b' Test visibility of in-memory changes ins'
1170 $ hg unshelve --keep default
1158 $ hg unshelve --keep default
1171 temporarily committing pending changes (restore with 'hg unshelve --abort')
1159 temporarily committing pending changes (restore with 'hg unshelve --abort')
1172 rebasing shelved changes
1160 rebasing shelved changes
1173 rebasing 7:206bf5d4f922 "changes to: create conflict" (tip)
1174 ==== preupdate:
1161 ==== preupdate:
1175 VISIBLE 6:66b86db80ee4
1162 VISIBLE 6:66b86db80ee4
1176 ACTUAL 5:703117a2acfb
1163 ACTUAL 5:703117a2acfb
1177 ====
1164 ====
1178 ==== preupdate:
1165 ==== preupdate:
1179 VISIBLE 8:a0e04704317e
1166 VISIBLE 8:92fdbb7b4de7
1180 ACTUAL 5:703117a2acfb
1167 ACTUAL 5:703117a2acfb
1181 ====
1168 ====
1182 ==== preupdate:
1169 ==== preupdate:
@@ -1215,7 +1202,6 b' Test visibility of in-memory changes ins'
1215 $ hg unshelve --keep default
1202 $ hg unshelve --keep default
1216 temporarily committing pending changes (restore with 'hg unshelve --abort')
1203 temporarily committing pending changes (restore with 'hg unshelve --abort')
1217 rebasing shelved changes
1204 rebasing shelved changes
1218 rebasing 7:206bf5d4f922 "changes to: create conflict" (tip)
1219 ==== update:
1205 ==== update:
1220 VISIBLE 6:66b86db80ee4
1206 VISIBLE 6:66b86db80ee4
1221 VISIBLE 7:206bf5d4f922
1207 VISIBLE 7:206bf5d4f922
@@ -1355,7 +1341,6 b' If I shelve, add the file, and unshelve,'
1355 unshelving change 'default'
1341 unshelving change 'default'
1356 temporarily committing pending changes (restore with 'hg unshelve --abort')
1342 temporarily committing pending changes (restore with 'hg unshelve --abort')
1357 rebasing shelved changes
1343 rebasing shelved changes
1358 rebasing 1:098df96e7410 "(changes in empty repository)" (tip)
1359 merging unknown
1344 merging unknown
1360 $ hg status
1345 $ hg status
1361 A unknown
1346 A unknown
@@ -1376,7 +1361,6 b' And if I shelve, commit, then unshelve, '
1376 $ hg unshelve
1361 $ hg unshelve
1377 unshelving change 'default'
1362 unshelving change 'default'
1378 rebasing shelved changes
1363 rebasing shelved changes
1379 rebasing 1:098df96e7410 "(changes in empty repository)" (tip)
1380 merging unknown
1364 merging unknown
1381 $ hg status
1365 $ hg status
1382 M unknown
1366 M unknown
@@ -1509,7 +1493,6 b' will be preserved.'
1509 unshelving change 'default'
1493 unshelving change 'default'
1510 temporarily committing pending changes (restore with 'hg unshelve --abort')
1494 temporarily committing pending changes (restore with 'hg unshelve --abort')
1511 rebasing shelved changes
1495 rebasing shelved changes
1512 rebasing 2:425c97ef07f3 "changes to: a" (tip)
1513 merging a
1496 merging a
1514 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
1497 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
1515 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
1498 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
@@ -1544,7 +1527,6 b' test branch.'
1544 $ hg unshelve
1527 $ hg unshelve
1545 unshelving change 'test'
1528 unshelving change 'test'
1546 rebasing shelved changes
1529 rebasing shelved changes
1547 rebasing 2:357525f34729 "changes to: test-commit" (tip)
1548 $ hg status
1530 $ hg status
1549 A b
1531 A b
1550 $ hg branch
1532 $ hg branch
@@ -1585,7 +1567,6 b' shelve on new branch, conflict with prev'
1585 unshelving change 'default'
1567 unshelving change 'default'
1586 temporarily committing pending changes (restore with 'hg unshelve --abort')
1568 temporarily committing pending changes (restore with 'hg unshelve --abort')
1587 rebasing shelved changes
1569 rebasing shelved changes
1588 rebasing 2:425c97ef07f3 "changes to: a" (tip)
1589 merging a
1570 merging a
1590 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
1571 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
1591 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
1572 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
@@ -1658,7 +1639,6 b' Prepare unshelve with a corrupted shelve'
1658 $ hg unshelve
1639 $ hg unshelve
1659 unshelving change 'default'
1640 unshelving change 'default'
1660 rebasing shelved changes
1641 rebasing shelved changes
1661 rebasing 1:396ea74229f9 "(changes in empty repository)" (tip)
1662 merging file
1642 merging file
1663 warning: conflicts while merging file! (edit, then use 'hg resolve --mark')
1643 warning: conflicts while merging file! (edit, then use 'hg resolve --mark')
1664 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
1644 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
@@ -1697,7 +1677,6 b' Unshelve respects --keep even if user in'
1697 $ hg unshelve --keep
1677 $ hg unshelve --keep
1698 unshelving change 'default'
1678 unshelving change 'default'
1699 rebasing shelved changes
1679 rebasing shelved changes
1700 rebasing 2:3fbe6fbb0bef "changes to: 1" (tip)
1701 merging file
1680 merging file
1702 warning: conflicts while merging file! (edit, then use 'hg resolve --mark')
1681 warning: conflicts while merging file! (edit, then use 'hg resolve --mark')
1703 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
1682 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
@@ -1755,7 +1734,6 b' New versions of Mercurial know how to re'
1755 $ hg unshelve
1734 $ hg unshelve
1756 unshelving change 'ashelve'
1735 unshelving change 'ashelve'
1757 rebasing shelved changes
1736 rebasing shelved changes
1758 rebasing 2:003d2d94241c "changes to: root" (tip)
1759 merging a
1737 merging a
1760 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
1738 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
1761 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
1739 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
General Comments 0
You need to be logged in to leave comments. Login now