Show More
@@ -0,0 +1,93 b'' | |||||
|
1 | #!/bin/sh | |||
|
2 | ||||
|
3 | hg init test | |||
|
4 | cd test | |||
|
5 | cat >>afile <<EOF | |||
|
6 | 0 | |||
|
7 | EOF | |||
|
8 | hg add afile | |||
|
9 | hg commit -m "0.0" -d "1000000 0" | |||
|
10 | cat >>afile <<EOF | |||
|
11 | 1 | |||
|
12 | EOF | |||
|
13 | hg commit -m "0.1" -d "1000000 0" | |||
|
14 | cat >>afile <<EOF | |||
|
15 | 2 | |||
|
16 | EOF | |||
|
17 | hg commit -m "0.2" -d "1000000 0" | |||
|
18 | cat >>afile <<EOF | |||
|
19 | 3 | |||
|
20 | EOF | |||
|
21 | hg commit -m "0.3" -d "1000000 0" | |||
|
22 | hg update -C 0 | |||
|
23 | cat >>afile <<EOF | |||
|
24 | 1 | |||
|
25 | EOF | |||
|
26 | hg commit -m "1.1" -d "1000000 0" | |||
|
27 | cat >>afile <<EOF | |||
|
28 | 2 | |||
|
29 | EOF | |||
|
30 | hg commit -m "1.2" -d "1000000 0" | |||
|
31 | cat >fred <<EOF | |||
|
32 | a line | |||
|
33 | EOF | |||
|
34 | cat >>afile <<EOF | |||
|
35 | 3 | |||
|
36 | EOF | |||
|
37 | hg add fred | |||
|
38 | hg commit -m "1.3" -d "1000000 0" | |||
|
39 | hg mv afile adifferentfile | |||
|
40 | hg commit -m "1.3m" -d "1000000 0" | |||
|
41 | hg update -C 3 | |||
|
42 | hg mv afile anotherfile | |||
|
43 | hg commit -m "0.3m" -d "1000000 0" | |||
|
44 | hg debugindex .hg/data/afile.i | |||
|
45 | hg debugindex .hg/data/adifferentfile.i | |||
|
46 | hg debugindex .hg/data/anotherfile.i | |||
|
47 | hg debugindex .hg/data/fred.i | |||
|
48 | hg debugindex .hg/00manifest.i | |||
|
49 | hg verify | |||
|
50 | cd .. | |||
|
51 | for i in 0 1 2 3 4 5 6 7 8; do | |||
|
52 | mkdir test-"$i" | |||
|
53 | hg --cwd test-"$i" init | |||
|
54 | hg -R test bundle -r "$i" test-"$i".hg test-"$i" | |||
|
55 | cd test-"$i" | |||
|
56 | hg unbundle ../test-"$i".hg | |||
|
57 | hg verify | |||
|
58 | hg tip -q | |||
|
59 | cd .. | |||
|
60 | done | |||
|
61 | cd test-8 | |||
|
62 | hg pull ../test-7 | |||
|
63 | hg verify | |||
|
64 | hg rollback | |||
|
65 | cd .. | |||
|
66 | ||||
|
67 | echo % should fail | |||
|
68 | hg -R test bundle --base 2 -r tip test-bundle-branch1.hg test-3 | |||
|
69 | hg -R test bundle -r tip test-bundle-branch1.hg | |||
|
70 | ||||
|
71 | hg -R test bundle --base 2 -r tip test-bundle-branch1.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 | |||
|
74 | hg -R test bundle --base 3 -r tip test-bundle-should-fail.hg | |||
|
75 | cd test-2 | |||
|
76 | echo % 2 | |||
|
77 | hg tip -q | |||
|
78 | hg unbundle ../test-bundle-should-fail.hg | |||
|
79 | echo % 2 | |||
|
80 | hg tip -q | |||
|
81 | hg unbundle ../test-bundle-all.hg | |||
|
82 | echo % 8 | |||
|
83 | hg tip -q | |||
|
84 | hg rollback | |||
|
85 | echo % 2 | |||
|
86 | hg tip -q | |||
|
87 | hg unbundle ../test-bundle-branch1.hg | |||
|
88 | echo % 4 | |||
|
89 | hg tip -q | |||
|
90 | hg unbundle ../test-bundle-branch2.hg | |||
|
91 | echo % 8 | |||
|
92 | hg tip -q | |||
|
93 | hg verify |
@@ -0,0 +1,187 b'' | |||||
|
1 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
2 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved | |||
|
3 | rev offset length base linkrev nodeid p1 p2 | |||
|
4 | 0 0 3 0 0 362fef284ce2 000000000000 000000000000 | |||
|
5 | 1 3 5 1 1 125144f7e028 362fef284ce2 000000000000 | |||
|
6 | 2 8 7 2 2 4c982badb186 125144f7e028 000000000000 | |||
|
7 | 3 15 9 3 3 19b1fc555737 4c982badb186 000000000000 | |||
|
8 | rev offset length base linkrev nodeid p1 p2 | |||
|
9 | 0 0 75 0 7 905359268f77 000000000000 000000000000 | |||
|
10 | rev offset length base linkrev nodeid p1 p2 | |||
|
11 | 0 0 75 0 8 905359268f77 000000000000 000000000000 | |||
|
12 | rev offset length base linkrev nodeid p1 p2 | |||
|
13 | 0 0 8 0 6 12ab3bcc5ea4 000000000000 000000000000 | |||
|
14 | rev offset length base linkrev nodeid p1 p2 | |||
|
15 | 0 0 48 0 0 43eadb1d2d06 000000000000 000000000000 | |||
|
16 | 1 48 48 1 1 8b89697eba2c 43eadb1d2d06 000000000000 | |||
|
17 | 2 96 48 2 2 626a32663c2f 8b89697eba2c 000000000000 | |||
|
18 | 3 144 48 3 3 f54c32f13478 626a32663c2f 000000000000 | |||
|
19 | 4 192 58 3 6 de68e904d169 626a32663c2f 000000000000 | |||
|
20 | 5 250 68 3 7 3b45cc2ab868 de68e904d169 000000000000 | |||
|
21 | 6 318 54 6 8 24d86153a002 f54c32f13478 000000000000 | |||
|
22 | checking changesets | |||
|
23 | checking manifests | |||
|
24 | crosschecking files in changesets and manifests | |||
|
25 | checking files | |||
|
26 | 4 files, 9 changesets, 7 total revisions | |||
|
27 | searching for changes | |||
|
28 | adding changesets | |||
|
29 | adding manifests | |||
|
30 | adding file changes | |||
|
31 | added 1 changesets with 1 changes to 1 files | |||
|
32 | (run 'hg update' to get a working copy) | |||
|
33 | checking changesets | |||
|
34 | checking manifests | |||
|
35 | crosschecking files in changesets and manifests | |||
|
36 | checking files | |||
|
37 | 1 files, 1 changesets, 1 total revisions | |||
|
38 | 0:5649c9d34dd8 | |||
|
39 | searching for changes | |||
|
40 | adding changesets | |||
|
41 | adding manifests | |||
|
42 | adding file changes | |||
|
43 | added 2 changesets with 2 changes to 1 files | |||
|
44 | (run 'hg update' to get a working copy) | |||
|
45 | checking changesets | |||
|
46 | checking manifests | |||
|
47 | crosschecking files in changesets and manifests | |||
|
48 | checking files | |||
|
49 | 1 files, 2 changesets, 2 total revisions | |||
|
50 | 1:10b2180f755b | |||
|
51 | searching for changes | |||
|
52 | adding changesets | |||
|
53 | adding manifests | |||
|
54 | adding file changes | |||
|
55 | added 3 changesets with 3 changes to 1 files | |||
|
56 | (run 'hg update' to get a working copy) | |||
|
57 | checking changesets | |||
|
58 | checking manifests | |||
|
59 | crosschecking files in changesets and manifests | |||
|
60 | checking files | |||
|
61 | 1 files, 3 changesets, 3 total revisions | |||
|
62 | 2:d62976ca1e50 | |||
|
63 | searching for changes | |||
|
64 | adding changesets | |||
|
65 | adding manifests | |||
|
66 | adding file changes | |||
|
67 | added 4 changesets with 4 changes to 1 files | |||
|
68 | (run 'hg update' to get a working copy) | |||
|
69 | checking changesets | |||
|
70 | checking manifests | |||
|
71 | crosschecking files in changesets and manifests | |||
|
72 | checking files | |||
|
73 | 1 files, 4 changesets, 4 total revisions | |||
|
74 | 3:ac69c658229d | |||
|
75 | searching for changes | |||
|
76 | adding changesets | |||
|
77 | adding manifests | |||
|
78 | adding file changes | |||
|
79 | added 2 changesets with 2 changes to 1 files | |||
|
80 | (run 'hg update' to get a working copy) | |||
|
81 | checking changesets | |||
|
82 | checking manifests | |||
|
83 | crosschecking files in changesets and manifests | |||
|
84 | checking files | |||
|
85 | 1 files, 2 changesets, 2 total revisions | |||
|
86 | 1:5f4f3ceb285e | |||
|
87 | searching for changes | |||
|
88 | adding changesets | |||
|
89 | adding manifests | |||
|
90 | adding file changes | |||
|
91 | added 3 changesets with 3 changes to 1 files | |||
|
92 | (run 'hg update' to get a working copy) | |||
|
93 | checking changesets | |||
|
94 | checking manifests | |||
|
95 | crosschecking files in changesets and manifests | |||
|
96 | checking files | |||
|
97 | 1 files, 3 changesets, 3 total revisions | |||
|
98 | 2:024e4e7df376 | |||
|
99 | searching for changes | |||
|
100 | adding changesets | |||
|
101 | adding manifests | |||
|
102 | adding file changes | |||
|
103 | added 4 changesets with 5 changes to 2 files | |||
|
104 | (run 'hg update' to get a working copy) | |||
|
105 | checking changesets | |||
|
106 | checking manifests | |||
|
107 | crosschecking files in changesets and manifests | |||
|
108 | checking files | |||
|
109 | 2 files, 4 changesets, 5 total revisions | |||
|
110 | 3:1e3f6b843bd6 | |||
|
111 | searching for changes | |||
|
112 | adding changesets | |||
|
113 | adding manifests | |||
|
114 | adding file changes | |||
|
115 | added 5 changesets with 6 changes to 3 files | |||
|
116 | (run 'hg update' to get a working copy) | |||
|
117 | checking changesets | |||
|
118 | checking manifests | |||
|
119 | crosschecking files in changesets and manifests | |||
|
120 | checking files | |||
|
121 | 3 files, 5 changesets, 6 total revisions | |||
|
122 | 4:80fe151401c2 | |||
|
123 | searching for changes | |||
|
124 | adding changesets | |||
|
125 | adding manifests | |||
|
126 | adding file changes | |||
|
127 | added 5 changesets with 5 changes to 2 files | |||
|
128 | (run 'hg update' to get a working copy) | |||
|
129 | checking changesets | |||
|
130 | checking manifests | |||
|
131 | crosschecking files in changesets and manifests | |||
|
132 | checking files | |||
|
133 | 2 files, 5 changesets, 5 total revisions | |||
|
134 | 4:836ac62537ab | |||
|
135 | pulling from ../test-7 | |||
|
136 | searching for changes | |||
|
137 | adding changesets | |||
|
138 | adding manifests | |||
|
139 | adding file changes | |||
|
140 | added 4 changesets with 2 changes to 3 files (+1 heads) | |||
|
141 | (run 'hg heads' to see heads, 'hg merge' to merge) | |||
|
142 | checking changesets | |||
|
143 | checking manifests | |||
|
144 | crosschecking files in changesets and manifests | |||
|
145 | checking files | |||
|
146 | 4 files, 9 changesets, 7 total revisions | |||
|
147 | rolling back last transaction | |||
|
148 | % should fail | |||
|
149 | abort: --base is incompatible with specifiying a destination | |||
|
150 | abort: repository default-push not found! | |||
|
151 | % 2 | |||
|
152 | 2:d62976ca1e50 | |||
|
153 | adding changesets | |||
|
154 | abort: unknown parent ac69c658229d! | |||
|
155 | transaction abort! | |||
|
156 | rollback completed | |||
|
157 | % 2 | |||
|
158 | 2:d62976ca1e50 | |||
|
159 | adding changesets | |||
|
160 | adding manifests | |||
|
161 | adding file changes | |||
|
162 | added 6 changesets with 4 changes to 4 files (+1 heads) | |||
|
163 | (run 'hg heads' to see heads, 'hg merge' to merge) | |||
|
164 | % 8 | |||
|
165 | 8:836ac62537ab | |||
|
166 | rolling back last transaction | |||
|
167 | % 2 | |||
|
168 | 2:d62976ca1e50 | |||
|
169 | adding changesets | |||
|
170 | adding manifests | |||
|
171 | adding file changes | |||
|
172 | added 2 changesets with 2 changes to 2 files | |||
|
173 | (run 'hg update' to get a working copy) | |||
|
174 | % 4 | |||
|
175 | 4:836ac62537ab | |||
|
176 | adding changesets | |||
|
177 | adding manifests | |||
|
178 | adding file changes | |||
|
179 | added 4 changesets with 2 changes to 3 files (+1 heads) | |||
|
180 | (run 'hg heads' to see heads, 'hg merge' to merge) | |||
|
181 | % 8 | |||
|
182 | 8:80fe151401c2 | |||
|
183 | checking changesets | |||
|
184 | checking manifests | |||
|
185 | crosschecking files in changesets and manifests | |||
|
186 | checking files | |||
|
187 | 4 files, 9 changesets, 7 total revisions |
@@ -766,9 +766,12 b' def backout(ui, repo, rev, **opts):' | |||||
766 | def bundle(ui, repo, fname, dest=None, **opts): |
|
766 | def bundle(ui, repo, fname, dest=None, **opts): | |
767 | """create a changegroup file |
|
767 | """create a changegroup file | |
768 |
|
768 | |||
769 |
Generate a compressed changegroup file collecting |
|
769 | Generate a compressed changegroup file collecting changesets. | |
770 | not found in the other repository. |
|
770 | not found in the other repository. | |
771 |
|
771 | |||
|
772 | If no destination repository is specified the destination is | |||
|
773 | assumed to have all the node specified by --base. | |||
|
774 | ||||
772 | This file can then be transferred using conventional means and |
|
775 | This file can then be transferred using conventional means and | |
773 | applied to another repository with the unbundle command. This is |
|
776 | applied to another repository with the unbundle command. This is | |
774 | useful when native push and pull are not available or when |
|
777 | useful when native push and pull are not available or when | |
@@ -778,11 +781,34 b' def bundle(ui, repo, fname, dest=None, *' | |||||
778 | Unlike import/export, this exactly preserves all changeset |
|
781 | Unlike import/export, this exactly preserves all changeset | |
779 | contents including permissions, rename data, and revision history. |
|
782 | contents including permissions, rename data, and revision history. | |
780 | """ |
|
783 | """ | |
781 | dest = ui.expandpath(dest or 'default-push', dest or 'default') |
|
784 | revs = opts.get('rev') or None | |
782 | setremoteconfig(ui, opts) |
|
785 | if revs: | |
783 | other = hg.repository(ui, dest) |
|
786 | revs = [repo.lookup(rev) for rev in revs] | |
784 | o = repo.findoutgoing(other, force=opts['force']) |
|
787 | base = opts.get('base') | |
785 | cg = repo.changegroup(o, 'bundle') |
|
788 | if base: | |
|
789 | if dest: | |||
|
790 | raise util.Abort(_("--base is incompatible with specifiying " | |||
|
791 | "a destination")) | |||
|
792 | o = [] | |||
|
793 | for n in base: | |||
|
794 | o.extend(repo.changelog.children(repo.lookup(n))) | |||
|
795 | # add common ancestor | |||
|
796 | if revs: | |||
|
797 | all = o + revs | |||
|
798 | else: | |||
|
799 | all = o + repo.changelog.heads() | |||
|
800 | ancestor = reduce(lambda a, b: repo.changelog.ancestor(a, b), all) | |||
|
801 | o.append(ancestor) | |||
|
802 | else: | |||
|
803 | setremoteconfig(ui, opts) | |||
|
804 | dest = ui.expandpath(dest or 'default-push', dest or 'default') | |||
|
805 | other = hg.repository(ui, dest) | |||
|
806 | o = repo.findoutgoing(other, force=opts['force']) | |||
|
807 | ||||
|
808 | if revs: | |||
|
809 | cg = repo.changegroupsubset(o, revs, 'bundle') | |||
|
810 | else: | |||
|
811 | cg = repo.changegroup(o, 'bundle') | |||
786 | write_bundle(cg, fname) |
|
812 | write_bundle(cg, fname) | |
787 |
|
813 | |||
788 | def cat(ui, repo, file1, *pats, **opts): |
|
814 | def cat(ui, repo, file1, *pats, **opts): | |
@@ -2789,8 +2815,12 b' table = {' | |||||
2789 | (bundle, |
|
2815 | (bundle, | |
2790 | [('f', 'force', None, |
|
2816 | [('f', 'force', None, | |
2791 | _('run even when remote repository is unrelated')), |
|
2817 | _('run even when remote repository is unrelated')), | |
|
2818 | ('r', 'rev', [], | |||
|
2819 | _('a changeset you would like to bundle')), | |||
|
2820 | ('', 'base', [], | |||
|
2821 | _('a base changeset to specify instead of a destination')), | |||
2792 | ] + remoteopts, |
|
2822 | ] + remoteopts, | |
2793 | _('hg bundle FILE DEST')), |
|
2823 | _('hg bundle [--base REV]... [--rev REV]... FILE [DEST]')), | |
2794 | "cat": |
|
2824 | "cat": | |
2795 | (cat, |
|
2825 | (cat, | |
2796 | [('o', 'output', '', _('print output to file with formatted name')), |
|
2826 | [('o', 'output', '', _('print output to file with formatted name')), |
General Comments 0
You need to be logged in to leave comments.
Login now