Show More
@@ -32,6 +32,7 b' from . import (' | |||
|
32 | 32 | localrepo, |
|
33 | 33 | manifest, |
|
34 | 34 | mdiff, |
|
35 | node as nodemod, | |
|
35 | 36 | pathutil, |
|
36 | 37 | phases, |
|
37 | 38 | revlog, |
@@ -385,6 +386,16 b' class bundlerepository(localrepo.localre' | |||
|
385 | 386 | def getcwd(self): |
|
386 | 387 | return os.getcwd() # always outside the repo |
|
387 | 388 | |
|
389 | # Check if parents exist in localrepo before setting | |
|
390 | def setparents(self, p1, p2=nullid): | |
|
391 | p1rev = self.changelog.rev(p1) | |
|
392 | p2rev = self.changelog.rev(p2) | |
|
393 | msg = _("setting parent to node %s that only exists in the bundle\n") | |
|
394 | if self.changelog.repotiprev < p1rev: | |
|
395 | self.ui.warn(msg % nodemod.hex(p1)) | |
|
396 | if self.changelog.repotiprev < p2rev: | |
|
397 | self.ui.warn(msg % nodemod.hex(p2)) | |
|
398 | return super(bundlerepository, self).setparents(p1, p2) | |
|
388 | 399 | |
|
389 | 400 | def instance(ui, path, create): |
|
390 | 401 | if create: |
@@ -733,3 +733,77 b' bundle single branch' | |||
|
733 | 733 | $ hg bundle -r 'public()' no-output.hg |
|
734 | 734 | abort: no commits to bundle |
|
735 | 735 | [255] |
|
736 | ||
|
737 | $ cd .. | |
|
738 | ||
|
739 | When user merges to the revision existing only in the bundle, | |
|
740 | it should show warning that second parent of the working | |
|
741 | directory does not exist | |
|
742 | ||
|
743 | $ hg init update2bundled | |
|
744 | $ cd update2bundled | |
|
745 | $ cat <<EOF >> .hg/hgrc | |
|
746 | > [extensions] | |
|
747 | > strip = | |
|
748 | > EOF | |
|
749 | $ echo "aaa" >> a | |
|
750 | $ hg commit -A -m 0 | |
|
751 | adding a | |
|
752 | $ echo "bbb" >> b | |
|
753 | $ hg commit -A -m 1 | |
|
754 | adding b | |
|
755 | $ echo "ccc" >> c | |
|
756 | $ hg commit -A -m 2 | |
|
757 | adding c | |
|
758 | $ hg update -r 1 | |
|
759 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
|
760 | $ echo "ddd" >> d | |
|
761 | $ hg commit -A -m 3 | |
|
762 | adding d | |
|
763 | created new head | |
|
764 | $ hg update -r 2 | |
|
765 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
|
766 | $ hg log -G | |
|
767 | o changeset: 3:8bd3e1f196af | |
|
768 | | tag: tip | |
|
769 | | parent: 1:a01eca7af26d | |
|
770 | | user: test | |
|
771 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
772 | | summary: 3 | |
|
773 | | | |
|
774 | | @ changeset: 2:4652c276ac4f | |
|
775 | |/ user: test | |
|
776 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
777 | | summary: 2 | |
|
778 | | | |
|
779 | o changeset: 1:a01eca7af26d | |
|
780 | | user: test | |
|
781 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
782 | | summary: 1 | |
|
783 | | | |
|
784 | o changeset: 0:4fe08cd4693e | |
|
785 | user: test | |
|
786 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
787 | summary: 0 | |
|
788 | ||
|
789 | $ hg bundle --base 1 -r 3 ../update2bundled.hg | |
|
790 | 1 changesets found | |
|
791 | $ hg strip -r 3 | |
|
792 | saved backup bundle to $TESTTMP/update2bundled/.hg/strip-backup/8bd3e1f196af-017e56d8-backup.hg (glob) | |
|
793 | $ hg merge -R ../update2bundled.hg -r 3 | |
|
794 | setting parent to node 8bd3e1f196af289b2b121be08031e76d7ae92098 that only exists in the bundle | |
|
795 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
796 | (branch merge, don't forget to commit) | |
|
797 | ||
|
798 | When user updates to the revision existing only in the bundle, | |
|
799 | it should show warning | |
|
800 | ||
|
801 | $ hg update -R ../update2bundled.hg --clean -r 3 | |
|
802 | setting parent to node 8bd3e1f196af289b2b121be08031e76d7ae92098 that only exists in the bundle | |
|
803 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
|
804 | ||
|
805 | When user updates to the revision existing in the local repository | |
|
806 | the warning shouldn't be emitted | |
|
807 | ||
|
808 | $ hg update -R ../update2bundled.hg -r 0 | |
|
809 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
General Comments 0
You need to be logged in to leave comments.
Login now