##// END OF EJS Templates
bundle --base: use the right set for the base
Benoit Boissinot -
r3318:a225055b default
parent child Browse files
Show More
@@ -789,16 +789,25 b' def bundle(ui, repo, fname, dest=None, *'
789 if dest:
789 if dest:
790 raise util.Abort(_("--base is incompatible with specifiying "
790 raise util.Abort(_("--base is incompatible with specifiying "
791 "a destination"))
791 "a destination"))
792 base = [repo.lookup(rev) for rev in base]
793 # create the right base
794 # XXX: nodesbetween / changegroup* should be "fixed" instead
792 o = []
795 o = []
796 has_set = sets.Set(base)
793 for n in base:
797 for n in base:
794 o.extend(repo.changelog.children(repo.lookup(n)))
798 has_set.update(repo.changelog.reachable(n))
795 # add common ancestor
796 if revs:
799 if revs:
797 all = o + revs
800 visit = list(revs)
798 else:
801 else:
799 all = o + repo.changelog.heads()
802 visit = repo.changelog.heads()
800 ancestor = reduce(lambda a, b: repo.changelog.ancestor(a, b), all)
803 while visit:
801 o.append(ancestor)
804 n = visit.pop(0)
805 parents = [p for p in repo.changelog.parents(n)
806 if p != nullid and p not in has_set]
807 if len(parents) == 0:
808 o.insert(0, n)
809 else:
810 visit.extend(parents)
802 else:
811 else:
803 setremoteconfig(ui, opts)
812 setremoteconfig(ui, opts)
804 dest = ui.expandpath(dest or 'default-push', dest or 'default')
813 dest = ui.expandpath(dest or 'default-push', dest or 'default')
@@ -72,7 +72,8 b' hg -R test bundle --base 2 -r tip test-b'
72 hg -R test bundle --base 2 -r 7 test-bundle-branch2.hg
72 hg -R test bundle --base 2 -r 7 test-bundle-branch2.hg
73 hg -R test bundle --base 2 test-bundle-all.hg
73 hg -R test bundle --base 2 test-bundle-all.hg
74 hg -R test bundle --base 3 -r tip test-bundle-should-fail.hg
74 hg -R test bundle --base 3 -r tip test-bundle-should-fail.hg
75 cd test-2
75 hg clone test-2 test-9
76 cd test-9
76 echo % 2
77 echo % 2
77 hg tip -q
78 hg tip -q
78 hg unbundle ../test-bundle-should-fail.hg
79 hg unbundle ../test-bundle-should-fail.hg
@@ -81,13 +82,28 b' hg tip -q'
81 hg unbundle ../test-bundle-all.hg
82 hg unbundle ../test-bundle-all.hg
82 echo % 8
83 echo % 8
83 hg tip -q
84 hg tip -q
85 hg verify
84 hg rollback
86 hg rollback
85 echo % 2
87 echo % 2
86 hg tip -q
88 hg tip -q
87 hg unbundle ../test-bundle-branch1.hg
89 hg unbundle ../test-bundle-branch1.hg
88 echo % 4
90 echo % 4
89 hg tip -q
91 hg tip -q
92 hg verify
93 hg rollback
90 hg unbundle ../test-bundle-branch2.hg
94 hg unbundle ../test-bundle-branch2.hg
91 echo % 8
95 echo % 6
92 hg tip -q
96 hg tip -q
93 hg verify
97 hg verify
98
99 cd ../test
100 hg merge 7
101 hg ci -m merge -d "1000000 0"
102 cd ..
103 hg -R test bundle --base 2 test-bundle-head.hg
104 hg clone test-2 test-10
105 cd test-10
106 hg unbundle ../test-bundle-head.hg
107 echo % 9
108 hg tip -q
109 hg verify
@@ -148,6 +148,7 b' rolling back last transaction'
148 % should fail
148 % should fail
149 abort: --base is incompatible with specifiying a destination
149 abort: --base is incompatible with specifiying a destination
150 abort: repository default-push not found!
150 abort: repository default-push not found!
151 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
151 % 2
152 % 2
152 2:d62976ca1e50
153 2:d62976ca1e50
153 adding changesets
154 adding changesets
@@ -163,6 +164,11 b' added 6 changesets with 4 changes to 4 f'
163 (run 'hg heads' to see heads, 'hg merge' to merge)
164 (run 'hg heads' to see heads, 'hg merge' to merge)
164 % 8
165 % 8
165 8:836ac62537ab
166 8:836ac62537ab
167 checking changesets
168 checking manifests
169 crosschecking files in changesets and manifests
170 checking files
171 4 files, 9 changesets, 7 total revisions
166 rolling back last transaction
172 rolling back last transaction
167 % 2
173 % 2
168 2:d62976ca1e50
174 2:d62976ca1e50
@@ -173,15 +179,36 b' added 2 changesets with 2 changes to 2 f'
173 (run 'hg update' to get a working copy)
179 (run 'hg update' to get a working copy)
174 % 4
180 % 4
175 4:836ac62537ab
181 4:836ac62537ab
182 checking changesets
183 checking manifests
184 crosschecking files in changesets and manifests
185 checking files
186 2 files, 5 changesets, 5 total revisions
187 rolling back last transaction
176 adding changesets
188 adding changesets
177 adding manifests
189 adding manifests
178 adding file changes
190 adding file changes
179 added 4 changesets with 2 changes to 3 files (+1 heads)
191 added 4 changesets with 3 changes to 3 files (+1 heads)
180 (run 'hg heads' to see heads, 'hg merge' to merge)
192 (run 'hg heads' to see heads, 'hg merge' to merge)
181 % 8
193 % 6
182 8:80fe151401c2
194 6:80fe151401c2
183 checking changesets
195 checking changesets
184 checking manifests
196 checking manifests
185 crosschecking files in changesets and manifests
197 crosschecking files in changesets and manifests
186 checking files
198 checking files
187 4 files, 9 changesets, 7 total revisions
199 3 files, 7 changesets, 6 total revisions
200 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
201 (branch merge, don't forget to commit)
202 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
203 adding changesets
204 adding manifests
205 adding file changes
206 added 7 changesets with 4 changes to 4 files
207 (run 'hg update' to get a working copy)
208 % 9
209 9:607fe5912aad
210 checking changesets
211 checking manifests
212 crosschecking files in changesets and manifests
213 checking files
214 4 files, 10 changesets, 7 total revisions
General Comments 0
You need to be logged in to leave comments. Login now