Show More
@@ -0,0 +1,61 b'' | |||||
|
1 | #!/bin/bash | |||
|
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" | |||
|
10 | cat >>afile <<EOF | |||
|
11 | 1 | |||
|
12 | EOF | |||
|
13 | hg commit -m "0.1" | |||
|
14 | cat >>afile <<EOF | |||
|
15 | 2 | |||
|
16 | EOF | |||
|
17 | hg commit -m "0.2" | |||
|
18 | cat >>afile <<EOF | |||
|
19 | 3 | |||
|
20 | EOF | |||
|
21 | hg commit -m "0.3" | |||
|
22 | hg update -C 0 | |||
|
23 | cat >>afile <<EOF | |||
|
24 | 1 | |||
|
25 | EOF | |||
|
26 | hg commit -m "1.1" | |||
|
27 | cat >>afile <<EOF | |||
|
28 | 2 | |||
|
29 | EOF | |||
|
30 | hg commit -m "1.2" | |||
|
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" | |||
|
39 | hg mv afile adifferentfile | |||
|
40 | hg commit -m "1.3m" | |||
|
41 | hg update -C 3 | |||
|
42 | hg mv afile anotherfile | |||
|
43 | hg commit -m "0.3m" | |||
|
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 push -r "$i" test-"$i" | |||
|
55 | cd test-"$i" | |||
|
56 | hg verify | |||
|
57 | cd .. | |||
|
58 | done | |||
|
59 | cd test-8 | |||
|
60 | hg pull ../test-7 | |||
|
61 | hg verify |
@@ -0,0 +1,135 b'' | |||||
|
1 | rev offset length base linkrev nodeid p1 p2 | |||
|
2 | 0 0 3 0 0 362fef284ce2 000000000000 000000000000 | |||
|
3 | 1 3 5 1 1 125144f7e028 362fef284ce2 000000000000 | |||
|
4 | 2 8 7 2 2 4c982badb186 125144f7e028 000000000000 | |||
|
5 | 3 15 9 3 3 19b1fc555737 4c982badb186 000000000000 | |||
|
6 | rev offset length base linkrev nodeid p1 p2 | |||
|
7 | 0 0 75 0 7 905359268f77 000000000000 000000000000 | |||
|
8 | rev offset length base linkrev nodeid p1 p2 | |||
|
9 | 0 0 75 0 8 905359268f77 000000000000 000000000000 | |||
|
10 | rev offset length base linkrev nodeid p1 p2 | |||
|
11 | 0 0 8 0 6 12ab3bcc5ea4 000000000000 000000000000 | |||
|
12 | rev offset length base linkrev nodeid p1 p2 | |||
|
13 | 0 0 48 0 0 43eadb1d2d06 000000000000 000000000000 | |||
|
14 | 1 48 48 1 1 8b89697eba2c 43eadb1d2d06 000000000000 | |||
|
15 | 2 96 48 2 2 626a32663c2f 8b89697eba2c 000000000000 | |||
|
16 | 3 144 48 3 3 f54c32f13478 626a32663c2f 000000000000 | |||
|
17 | 4 192 58 3 6 de68e904d169 626a32663c2f 000000000000 | |||
|
18 | 5 250 68 3 7 3b45cc2ab868 de68e904d169 000000000000 | |||
|
19 | 6 318 54 6 8 24d86153a002 f54c32f13478 000000000000 | |||
|
20 | checking changesets | |||
|
21 | checking manifests | |||
|
22 | crosschecking files in changesets and manifests | |||
|
23 | checking files | |||
|
24 | 4 files, 9 changesets, 7 total revisions | |||
|
25 | pushing to test-0 | |||
|
26 | searching for changes | |||
|
27 | adding changesets | |||
|
28 | adding manifests | |||
|
29 | adding file changes | |||
|
30 | added 1 changesets with 1 changes to 1 files | |||
|
31 | checking changesets | |||
|
32 | checking manifests | |||
|
33 | crosschecking files in changesets and manifests | |||
|
34 | checking files | |||
|
35 | 1 files, 1 changesets, 1 total revisions | |||
|
36 | pushing to test-1 | |||
|
37 | searching for changes | |||
|
38 | adding changesets | |||
|
39 | adding manifests | |||
|
40 | adding file changes | |||
|
41 | added 2 changesets with 2 changes to 1 files | |||
|
42 | checking changesets | |||
|
43 | checking manifests | |||
|
44 | crosschecking files in changesets and manifests | |||
|
45 | checking files | |||
|
46 | 1 files, 2 changesets, 2 total revisions | |||
|
47 | pushing to test-2 | |||
|
48 | searching for changes | |||
|
49 | adding changesets | |||
|
50 | adding manifests | |||
|
51 | adding file changes | |||
|
52 | added 3 changesets with 3 changes to 1 files | |||
|
53 | checking changesets | |||
|
54 | checking manifests | |||
|
55 | crosschecking files in changesets and manifests | |||
|
56 | checking files | |||
|
57 | 1 files, 3 changesets, 3 total revisions | |||
|
58 | pushing to test-3 | |||
|
59 | searching for changes | |||
|
60 | adding changesets | |||
|
61 | adding manifests | |||
|
62 | adding file changes | |||
|
63 | added 4 changesets with 4 changes to 1 files | |||
|
64 | checking changesets | |||
|
65 | checking manifests | |||
|
66 | crosschecking files in changesets and manifests | |||
|
67 | checking files | |||
|
68 | 1 files, 4 changesets, 4 total revisions | |||
|
69 | pushing to test-4 | |||
|
70 | searching for changes | |||
|
71 | adding changesets | |||
|
72 | adding manifests | |||
|
73 | adding file changes | |||
|
74 | added 2 changesets with 2 changes to 1 files | |||
|
75 | checking changesets | |||
|
76 | checking manifests | |||
|
77 | crosschecking files in changesets and manifests | |||
|
78 | checking files | |||
|
79 | 1 files, 2 changesets, 2 total revisions | |||
|
80 | pushing to test-5 | |||
|
81 | searching for changes | |||
|
82 | adding changesets | |||
|
83 | adding manifests | |||
|
84 | adding file changes | |||
|
85 | added 3 changesets with 3 changes to 1 files | |||
|
86 | checking changesets | |||
|
87 | checking manifests | |||
|
88 | crosschecking files in changesets and manifests | |||
|
89 | checking files | |||
|
90 | 1 files, 3 changesets, 3 total revisions | |||
|
91 | pushing to test-6 | |||
|
92 | searching for changes | |||
|
93 | adding changesets | |||
|
94 | adding manifests | |||
|
95 | adding file changes | |||
|
96 | added 4 changesets with 5 changes to 2 files | |||
|
97 | checking changesets | |||
|
98 | checking manifests | |||
|
99 | crosschecking files in changesets and manifests | |||
|
100 | checking files | |||
|
101 | 2 files, 4 changesets, 5 total revisions | |||
|
102 | pushing to test-7 | |||
|
103 | searching for changes | |||
|
104 | adding changesets | |||
|
105 | adding manifests | |||
|
106 | adding file changes | |||
|
107 | added 5 changesets with 6 changes to 3 files | |||
|
108 | checking changesets | |||
|
109 | checking manifests | |||
|
110 | crosschecking files in changesets and manifests | |||
|
111 | checking files | |||
|
112 | 3 files, 5 changesets, 6 total revisions | |||
|
113 | pushing to test-8 | |||
|
114 | searching for changes | |||
|
115 | adding changesets | |||
|
116 | adding manifests | |||
|
117 | adding file changes | |||
|
118 | added 5 changesets with 5 changes to 2 files | |||
|
119 | checking changesets | |||
|
120 | checking manifests | |||
|
121 | crosschecking files in changesets and manifests | |||
|
122 | checking files | |||
|
123 | 2 files, 5 changesets, 5 total revisions | |||
|
124 | pulling from ../test-7 | |||
|
125 | searching for changes | |||
|
126 | adding changesets | |||
|
127 | adding manifests | |||
|
128 | adding file changes | |||
|
129 | added 4 changesets with 2 changes to 3 files (+1 heads) | |||
|
130 | (run 'hg update' to get a working copy) | |||
|
131 | checking changesets | |||
|
132 | checking manifests | |||
|
133 | crosschecking files in changesets and manifests | |||
|
134 | checking files | |||
|
135 | 4 files, 9 changesets, 7 total revisions |
@@ -1764,7 +1764,7 b' def pull(ui, repo, source="default", **o' | |||||
1764 |
|
1764 | |||
1765 | return r |
|
1765 | return r | |
1766 |
|
1766 | |||
1767 |
def push(ui, repo, dest="default-push", |
|
1767 | def push(ui, repo, dest="default-push", **opts): | |
1768 | """push changes to the specified destination |
|
1768 | """push changes to the specified destination | |
1769 |
|
1769 | |||
1770 | Push changes from the local repository to the given destination. |
|
1770 | Push changes from the local repository to the given destination. | |
@@ -1789,13 +1789,16 b' def push(ui, repo, dest="default-push", ' | |||||
1789 | dest = ui.expandpath(dest, repo.root) |
|
1789 | dest = ui.expandpath(dest, repo.root) | |
1790 | ui.status('pushing to %s\n' % (dest)) |
|
1790 | ui.status('pushing to %s\n' % (dest)) | |
1791 |
|
1791 | |||
1792 | if ssh: |
|
1792 | if opts['ssh']: | |
1793 | ui.setconfig("ui", "ssh", ssh) |
|
1793 | ui.setconfig("ui", "ssh", opts['ssh']) | |
1794 | if remotecmd: |
|
1794 | if opts['remotecmd']: | |
1795 | ui.setconfig("ui", "remotecmd", remotecmd) |
|
1795 | ui.setconfig("ui", "remotecmd", opts['remotecmd']) | |
1796 |
|
1796 | |||
1797 | other = hg.repository(ui, dest) |
|
1797 | other = hg.repository(ui, dest) | |
1798 | r = repo.push(other, force) |
|
1798 | revs = None | |
|
1799 | if opts['rev']: | |||
|
1800 | revs = [repo.lookup(rev) for rev in opts['rev']] | |||
|
1801 | r = repo.push(other, opts['force'], revs=revs) | |||
1799 | return r |
|
1802 | return r | |
1800 |
|
1803 | |||
1801 | def rawcommit(ui, repo, *flist, **rc): |
|
1804 | def rawcommit(ui, repo, *flist, **rc): | |
@@ -2417,14 +2420,15 b' table = {' | |||||
2417 | ('r', 'rev', [], _('a specific revision you would like to pull')), |
|
2420 | ('r', 'rev', [], _('a specific revision you would like to pull')), | |
2418 | ('', 'remotecmd', '', |
|
2421 | ('', 'remotecmd', '', | |
2419 | _('specify hg command to run on the remote side'))], |
|
2422 | _('specify hg command to run on the remote side'))], | |
2420 | _('hg pull [-u] [-e FILE] [-r rev] [--remotecmd FILE] [SOURCE]')), |
|
2423 | _('hg pull [-u] [-e FILE] [-r rev]... [--remotecmd FILE] [SOURCE]')), | |
2421 | "^push": |
|
2424 | "^push": | |
2422 | (push, |
|
2425 | (push, | |
2423 | [('f', 'force', None, _('force push')), |
|
2426 | [('f', 'force', None, _('force push')), | |
2424 | ('e', 'ssh', '', _('specify ssh command to use')), |
|
2427 | ('e', 'ssh', '', _('specify ssh command to use')), | |
|
2428 | ('r', 'rev', [], _('a specific revision you would like to push')), | |||
2425 | ('', 'remotecmd', '', |
|
2429 | ('', 'remotecmd', '', | |
2426 | _('specify hg command to run on the remote side'))], |
|
2430 | _('specify hg command to run on the remote side'))], | |
2427 | _('hg push [-f] [-e FILE] [--remotecmd FILE] [DEST]')), |
|
2431 | _('hg push [-f] [-e FILE] [-r rev]... [--remotecmd FILE] [DEST]')), | |
2428 | "rawcommit": |
|
2432 | "rawcommit": | |
2429 | (rawcommit, |
|
2433 | (rawcommit, | |
2430 | [('p', 'parent', [], _('parent')), |
|
2434 | [('p', 'parent', [], _('parent')), |
@@ -952,7 +952,7 b' class localrepository(object):' | |||||
952 | cg = remote.changegroupsubset(fetch, heads) |
|
952 | cg = remote.changegroupsubset(fetch, heads) | |
953 | return self.addchangegroup(cg) |
|
953 | return self.addchangegroup(cg) | |
954 |
|
954 | |||
955 | def push(self, remote, force=False): |
|
955 | def push(self, remote, force=False, revs=None): | |
956 | lock = remote.lock() |
|
956 | lock = remote.lock() | |
957 |
|
957 | |||
958 | base = {} |
|
958 | base = {} | |
@@ -964,17 +964,25 b' class localrepository(object):' | |||||
964 | return 1 |
|
964 | return 1 | |
965 |
|
965 | |||
966 | update = self.findoutgoing(remote, base) |
|
966 | update = self.findoutgoing(remote, base) | |
967 |
if not |
|
967 | if revs is not None: | |
|
968 | msng_cl, bases, heads = self.changelog.nodesbetween(update, revs) | |||
|
969 | else: | |||
|
970 | bases, heads = update, self.changelog.heads() | |||
|
971 | ||||
|
972 | if not bases: | |||
968 | self.ui.status(_("no changes found\n")) |
|
973 | self.ui.status(_("no changes found\n")) | |
969 | return 1 |
|
974 | return 1 | |
970 | elif not force: |
|
975 | elif not force: | |
971 |
if len( |
|
976 | if len(bases) < len(heads): | |
972 | self.ui.warn(_("abort: push creates new remote branches!\n")) |
|
977 | self.ui.warn(_("abort: push creates new remote branches!\n")) | |
973 | self.ui.status(_("(did you forget to merge?" |
|
978 | self.ui.status(_("(did you forget to merge?" | |
974 | " use push -f to force)\n")) |
|
979 | " use push -f to force)\n")) | |
975 | return 1 |
|
980 | return 1 | |
976 |
|
981 | |||
977 | cg = self.changegroup(update) |
|
982 | if revs is None: | |
|
983 | cg = self.changegroup(update) | |||
|
984 | else: | |||
|
985 | cg = self.changegroupsubset(update, revs) | |||
978 | return remote.addchangegroup(cg) |
|
986 | return remote.addchangegroup(cg) | |
979 |
|
987 | |||
980 | def changegroupsubset(self, bases, heads): |
|
988 | def changegroupsubset(self, bases, heads): |
General Comments 0
You need to be logged in to leave comments.
Login now