Show More
@@ -1,201 +1,203 b'' | |||
|
1 | 1 | # httprepo.py - HTTP repository proxy classes for mercurial |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com> |
|
4 | 4 | # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com> |
|
5 | 5 | # |
|
6 | 6 | # This software may be used and distributed according to the terms of the |
|
7 | 7 | # GNU General Public License version 2 or any later version. |
|
8 | 8 | |
|
9 | 9 | from node import nullid |
|
10 | 10 | from i18n import _ |
|
11 | 11 | import changegroup, statichttprepo, error, url, util, wireproto |
|
12 | 12 | import os, urllib, urllib2, urlparse, zlib, httplib |
|
13 | 13 | import errno, socket |
|
14 | 14 | |
|
15 | 15 | def zgenerator(f): |
|
16 | 16 | zd = zlib.decompressobj() |
|
17 | 17 | try: |
|
18 | 18 | for chunk in util.filechunkiter(f): |
|
19 | 19 | while chunk: |
|
20 | 20 | yield zd.decompress(chunk, 2**18) |
|
21 | 21 | chunk = zd.unconsumed_tail |
|
22 | 22 | except httplib.HTTPException: |
|
23 | 23 | raise IOError(None, _('connection ended unexpectedly')) |
|
24 | 24 | yield zd.flush() |
|
25 | 25 | |
|
26 | 26 | class httprepository(wireproto.wirerepository): |
|
27 | 27 | def __init__(self, ui, path): |
|
28 | 28 | self.path = path |
|
29 | 29 | self.caps = None |
|
30 | 30 | self.handler = None |
|
31 | 31 | scheme, netloc, urlpath, query, frag = urlparse.urlsplit(path) |
|
32 | 32 | if query or frag: |
|
33 | 33 | raise util.Abort(_('unsupported URL component: "%s"') % |
|
34 | 34 | (query or frag)) |
|
35 | 35 | |
|
36 | 36 | # urllib cannot handle URLs with embedded user or passwd |
|
37 | 37 | self._url, authinfo = url.getauthinfo(path) |
|
38 | 38 | |
|
39 | 39 | self.ui = ui |
|
40 | 40 | self.ui.debug('using %s\n' % self._url) |
|
41 | 41 | |
|
42 | 42 | self.urlopener = url.opener(ui, authinfo) |
|
43 | 43 | |
|
44 | 44 | def __del__(self): |
|
45 | 45 | for h in self.urlopener.handlers: |
|
46 | 46 | h.close() |
|
47 | 47 | if hasattr(h, "close_all"): |
|
48 | 48 | h.close_all() |
|
49 | 49 | |
|
50 | 50 | def url(self): |
|
51 | 51 | return self.path |
|
52 | 52 | |
|
53 | 53 | # look up capabilities only when needed |
|
54 | 54 | |
|
55 | 55 | def get_caps(self): |
|
56 | 56 | if self.caps is None: |
|
57 | 57 | try: |
|
58 | 58 | self.caps = set(self._call('capabilities').split()) |
|
59 | 59 | except error.RepoError: |
|
60 | 60 | self.caps = set() |
|
61 | 61 | self.ui.debug('capabilities: %s\n' % |
|
62 | 62 | (' '.join(self.caps or ['none']))) |
|
63 | 63 | return self.caps |
|
64 | 64 | |
|
65 | 65 | capabilities = property(get_caps) |
|
66 | 66 | |
|
67 | 67 | def lock(self): |
|
68 | 68 | raise util.Abort(_('operation not supported over http')) |
|
69 | 69 | |
|
70 | 70 | def _callstream(self, cmd, **args): |
|
71 | if cmd is 'pushkey': | |
|
72 | args['data'] = '' | |
|
71 | 73 | data = args.pop('data', None) |
|
72 | 74 | headers = args.pop('headers', {}) |
|
73 | 75 | self.ui.debug("sending %s command\n" % cmd) |
|
74 | 76 | q = {"cmd": cmd} |
|
75 | 77 | q.update(args) |
|
76 | 78 | qs = '?%s' % urllib.urlencode(q) |
|
77 | 79 | cu = "%s%s" % (self._url, qs) |
|
78 | 80 | req = urllib2.Request(cu, data, headers) |
|
79 | 81 | if data is not None: |
|
80 | 82 | # len(data) is broken if data doesn't fit into Py_ssize_t |
|
81 | 83 | # add the header ourself to avoid OverflowError |
|
82 | 84 | size = data.__len__() |
|
83 | 85 | self.ui.debug("sending %s bytes\n" % size) |
|
84 | 86 | req.add_unredirected_header('Content-Length', '%d' % size) |
|
85 | 87 | try: |
|
86 | 88 | resp = self.urlopener.open(req) |
|
87 | 89 | except urllib2.HTTPError, inst: |
|
88 | 90 | if inst.code == 401: |
|
89 | 91 | raise util.Abort(_('authorization failed')) |
|
90 | 92 | raise |
|
91 | 93 | except httplib.HTTPException, inst: |
|
92 | 94 | self.ui.debug('http error while sending %s command\n' % cmd) |
|
93 | 95 | self.ui.traceback() |
|
94 | 96 | raise IOError(None, inst) |
|
95 | 97 | except IndexError: |
|
96 | 98 | # this only happens with Python 2.3, later versions raise URLError |
|
97 | 99 | raise util.Abort(_('http error, possibly caused by proxy setting')) |
|
98 | 100 | # record the url we got redirected to |
|
99 | 101 | resp_url = resp.geturl() |
|
100 | 102 | if resp_url.endswith(qs): |
|
101 | 103 | resp_url = resp_url[:-len(qs)] |
|
102 | 104 | if self._url.rstrip('/') != resp_url.rstrip('/'): |
|
103 | 105 | self.ui.status(_('real URL is %s\n') % resp_url) |
|
104 | 106 | self._url = resp_url |
|
105 | 107 | try: |
|
106 | 108 | proto = resp.getheader('content-type') |
|
107 | 109 | except AttributeError: |
|
108 | 110 | proto = resp.headers['content-type'] |
|
109 | 111 | |
|
110 | 112 | safeurl = url.hidepassword(self._url) |
|
111 | 113 | # accept old "text/plain" and "application/hg-changegroup" for now |
|
112 | 114 | if not (proto.startswith('application/mercurial-') or |
|
113 | 115 | proto.startswith('text/plain') or |
|
114 | 116 | proto.startswith('application/hg-changegroup')): |
|
115 | 117 | self.ui.debug("requested URL: '%s'\n" % url.hidepassword(cu)) |
|
116 | 118 | raise error.RepoError( |
|
117 | 119 | _("'%s' does not appear to be an hg repository:\n" |
|
118 | 120 | "---%%<--- (%s)\n%s\n---%%<---\n") |
|
119 | 121 | % (safeurl, proto, resp.read())) |
|
120 | 122 | |
|
121 | 123 | if proto.startswith('application/mercurial-'): |
|
122 | 124 | try: |
|
123 | 125 | version = proto.split('-', 1)[1] |
|
124 | 126 | version_info = tuple([int(n) for n in version.split('.')]) |
|
125 | 127 | except ValueError: |
|
126 | 128 | raise error.RepoError(_("'%s' sent a broken Content-Type " |
|
127 | 129 | "header (%s)") % (safeurl, proto)) |
|
128 | 130 | if version_info > (0, 1): |
|
129 | 131 | raise error.RepoError(_("'%s' uses newer protocol %s") % |
|
130 | 132 | (safeurl, version)) |
|
131 | 133 | |
|
132 | 134 | return resp |
|
133 | 135 | |
|
134 | 136 | def _call(self, cmd, **args): |
|
135 | 137 | fp = self._callstream(cmd, **args) |
|
136 | 138 | try: |
|
137 | 139 | return fp.read() |
|
138 | 140 | finally: |
|
139 | 141 | # if using keepalive, allow connection to be reused |
|
140 | 142 | fp.close() |
|
141 | 143 | |
|
142 | 144 | def _callpush(self, cmd, cg, **args): |
|
143 | 145 | # have to stream bundle to a temp file because we do not have |
|
144 | 146 | # http 1.1 chunked transfer. |
|
145 | 147 | |
|
146 | 148 | type = "" |
|
147 | 149 | types = self.capable('unbundle') |
|
148 | 150 | # servers older than d1b16a746db6 will send 'unbundle' as a |
|
149 | 151 | # boolean capability |
|
150 | 152 | try: |
|
151 | 153 | types = types.split(',') |
|
152 | 154 | except AttributeError: |
|
153 | 155 | types = [""] |
|
154 | 156 | if types: |
|
155 | 157 | for x in types: |
|
156 | 158 | if x in changegroup.bundletypes: |
|
157 | 159 | type = x |
|
158 | 160 | break |
|
159 | 161 | |
|
160 | 162 | tempname = changegroup.writebundle(cg, None, type) |
|
161 | 163 | fp = url.httpsendfile(tempname, "rb") |
|
162 | 164 | headers = {'Content-Type': 'application/mercurial-0.1'} |
|
163 | 165 | |
|
164 | 166 | try: |
|
165 | 167 | try: |
|
166 | 168 | r = self._call(cmd, data=fp, headers=headers, **args) |
|
167 | 169 | return r.split('\n', 1) |
|
168 | 170 | except socket.error, err: |
|
169 | 171 | if err.args[0] in (errno.ECONNRESET, errno.EPIPE): |
|
170 | 172 | raise util.Abort(_('push failed: %s') % err.args[1]) |
|
171 | 173 | raise util.Abort(err.args[1]) |
|
172 | 174 | finally: |
|
173 | 175 | fp.close() |
|
174 | 176 | os.unlink(tempname) |
|
175 | 177 | |
|
176 | 178 | def _abort(self, exception): |
|
177 | 179 | raise exception |
|
178 | 180 | |
|
179 | 181 | def _decompress(self, stream): |
|
180 | 182 | return util.chunkbuffer(zgenerator(stream)) |
|
181 | 183 | |
|
182 | 184 | class httpsrepository(httprepository): |
|
183 | 185 | def __init__(self, ui, path): |
|
184 | 186 | if not url.has_https: |
|
185 | 187 | raise util.Abort(_('Python support for SSL and HTTPS ' |
|
186 | 188 | 'is not installed')) |
|
187 | 189 | httprepository.__init__(self, ui, path) |
|
188 | 190 | |
|
189 | 191 | def instance(ui, path, create): |
|
190 | 192 | if create: |
|
191 | 193 | raise util.Abort(_('cannot create new http repository')) |
|
192 | 194 | try: |
|
193 | 195 | if path.startswith('https:'): |
|
194 | 196 | inst = httpsrepository(ui, path) |
|
195 | 197 | else: |
|
196 | 198 | inst = httprepository(ui, path) |
|
197 | 199 | inst.between([(nullid, nullid)]) |
|
198 | 200 | return inst |
|
199 | 201 | except error.RepoError: |
|
200 | 202 | ui.note('(falling back to static-http)\n') |
|
201 | 203 | return statichttprepo.instance(ui, "static-" + path, create) |
@@ -1,66 +1,179 b'' | |||
|
1 | 1 | $ echo "[extensions]" >> $HGRCPATH |
|
2 | 2 | $ echo "bookmarks=" >> $HGRCPATH |
|
3 | 3 | |
|
4 | 4 | $ echo "[bookmarks]" >> $HGRCPATH |
|
5 | 5 | $ echo "track.current = True" >> $HGRCPATH |
|
6 | 6 | |
|
7 | 7 | initialize |
|
8 | 8 | |
|
9 | 9 | $ hg init a |
|
10 | 10 | $ cd a |
|
11 | 11 | $ echo 'test' > test |
|
12 | 12 | $ hg commit -Am'test' |
|
13 | 13 | adding test |
|
14 | 14 | |
|
15 | 15 | set bookmarks |
|
16 | 16 | |
|
17 | 17 | $ hg bookmark X |
|
18 | 18 | $ hg bookmark Y |
|
19 | 19 | $ hg bookmark Z |
|
20 | 20 | |
|
21 | 21 | import bookmark by name |
|
22 | 22 | |
|
23 | 23 | $ hg init ../b |
|
24 | 24 | $ cd ../b |
|
25 | $ hg book Y | |
|
26 | $ hg book | |
|
27 | * Y -1:000000000000 | |
|
25 | 28 | $ hg pull ../a |
|
26 | 29 | pulling from ../a |
|
27 | 30 | requesting all changes |
|
28 | 31 | adding changesets |
|
29 | 32 | adding manifests |
|
30 | 33 | adding file changes |
|
31 | 34 | added 1 changesets with 1 changes to 1 files |
|
32 | 35 | (run 'hg update' to get a working copy) |
|
33 | 36 | $ hg bookmarks |
|
34 | no bookmarks set | |
|
37 | Y 0:4e3505fd9583 | |
|
38 | $ hg debugpushkey ../a namespaces | |
|
39 | bookmarks | |
|
40 | namespaces | |
|
41 | $ hg debugpushkey ../a bookmarks | |
|
42 | Y 4e3505fd95835d721066b76e75dbb8cc554d7f77 | |
|
43 | X 4e3505fd95835d721066b76e75dbb8cc554d7f77 | |
|
44 | Z 4e3505fd95835d721066b76e75dbb8cc554d7f77 | |
|
35 | 45 | $ hg pull -B X ../a |
|
36 | 46 | pulling from ../a |
|
37 | 47 | searching for changes |
|
38 | 48 | no changes found |
|
39 | 49 | importing bookmark X |
|
40 | 50 | $ hg bookmark |
|
51 | Y 0:4e3505fd9583 | |
|
41 | 52 | X 0:4e3505fd9583 |
|
42 | 53 | |
|
43 | 54 | export bookmark by name |
|
44 | 55 | |
|
45 | 56 | $ hg bookmark W |
|
46 | 57 | $ hg bookmark foo |
|
47 | 58 | $ hg bookmark foobar |
|
48 | 59 | $ hg push -B W ../a |
|
49 | 60 | pushing to ../a |
|
50 | 61 | searching for changes |
|
51 | 62 | no changes found |
|
52 | 63 | exporting bookmark W |
|
53 | 64 | $ hg -R ../a bookmarks |
|
54 | 65 | Y 0:4e3505fd9583 |
|
55 | 66 | X 0:4e3505fd9583 |
|
56 | 67 | * Z 0:4e3505fd9583 |
|
57 | 68 | W -1:000000000000 |
|
58 | 69 | |
|
70 | delete a remote bookmark | |
|
71 | ||
|
72 | $ hg book -d W | |
|
73 | $ hg push -B W ../a | |
|
74 | deleting remote bookmark W | |
|
75 | ||
|
59 | 76 | push/pull name that doesn't exist |
|
60 | 77 | |
|
61 | 78 | $ hg push -B badname ../a |
|
62 | 79 | bookmark badname does not exist on the local or remote repository! |
|
63 | 80 | [2] |
|
64 | 81 | $ hg pull -B anotherbadname ../a |
|
65 | 82 | abort: remote bookmark anotherbadname not found! |
|
66 | 83 | [255] |
|
84 | ||
|
85 | divergent bookmarks | |
|
86 | ||
|
87 | $ cd ../a | |
|
88 | $ echo c1 > f1 | |
|
89 | $ hg ci -Am1 | |
|
90 | adding f1 | |
|
91 | $ hg book -f X | |
|
92 | $ hg book | |
|
93 | Y 0:4e3505fd9583 | |
|
94 | * X 1:0d2164f0ce0d | |
|
95 | Z 1:0d2164f0ce0d | |
|
96 | ||
|
97 | $ cd ../b | |
|
98 | $ hg up | |
|
99 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
100 | $ echo c2 > f2 | |
|
101 | $ hg ci -Am2 | |
|
102 | adding f2 | |
|
103 | $ hg book -f X | |
|
104 | $ hg book | |
|
105 | Y 0:4e3505fd9583 | |
|
106 | * X 1:9b140be10808 | |
|
107 | foo -1:000000000000 | |
|
108 | foobar -1:000000000000 | |
|
109 | ||
|
110 | $ hg pull ../a | |
|
111 | pulling from ../a | |
|
112 | searching for changes | |
|
113 | adding changesets | |
|
114 | adding manifests | |
|
115 | adding file changes | |
|
116 | added 1 changesets with 1 changes to 1 files (+1 heads) | |
|
117 | not updating divergent bookmark X | |
|
118 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
|
119 | $ hg book | |
|
120 | Y 0:4e3505fd9583 | |
|
121 | * X 1:9b140be10808 | |
|
122 | foo -1:000000000000 | |
|
123 | foobar -1:000000000000 | |
|
124 | $ hg push -f ../a | |
|
125 | pushing to ../a | |
|
126 | searching for changes | |
|
127 | adding changesets | |
|
128 | adding manifests | |
|
129 | adding file changes | |
|
130 | added 1 changesets with 1 changes to 1 files (+1 heads) | |
|
131 | $ hg -R ../a book | |
|
132 | Y 0:4e3505fd9583 | |
|
133 | * X 1:0d2164f0ce0d | |
|
134 | Z 1:0d2164f0ce0d | |
|
135 | ||
|
136 | hgweb | |
|
137 | ||
|
138 | $ cat <<EOF > .hg/hgrc | |
|
139 | > [web] | |
|
140 | > push_ssl = false | |
|
141 | > allow_push = * | |
|
142 | > EOF | |
|
143 | ||
|
144 | $ hg serve -p $HGPORT -d --pid-file=../hg.pid -E errors.log | |
|
145 | $ cat ../hg.pid >> $DAEMON_PIDS | |
|
146 | $ cd ../a | |
|
147 | ||
|
148 | $ hg debugpushkey http://localhost:$HGPORT/ namespaces | |
|
149 | bookmarks | |
|
150 | namespaces | |
|
151 | $ hg debugpushkey http://localhost:$HGPORT/ bookmarks | |
|
152 | Y 4e3505fd95835d721066b76e75dbb8cc554d7f77 | |
|
153 | X 9b140be1080824d768c5a4691a564088eede71f9 | |
|
154 | foo 0000000000000000000000000000000000000000 | |
|
155 | foobar 0000000000000000000000000000000000000000 | |
|
156 | $ hg out -B http://localhost:$HGPORT/ | |
|
157 | comparing with http://localhost:$HGPORT/ | |
|
158 | searching for changed bookmarks | |
|
159 | Z 0d2164f0ce0d | |
|
160 | $ hg push -B Z http://localhost:$HGPORT/ | |
|
161 | pushing to http://localhost:$HGPORT/ | |
|
162 | searching for changes | |
|
163 | no changes found | |
|
164 | exporting bookmark Z | |
|
165 | $ hg book -d Z | |
|
166 | $ hg in -B http://localhost:$HGPORT/ | |
|
167 | comparing with http://localhost:$HGPORT/ | |
|
168 | searching for changed bookmarks | |
|
169 | Z 0d2164f0ce0d | |
|
170 | foo 000000000000 | |
|
171 | foobar 000000000000 | |
|
172 | $ hg pull -B Z http://localhost:$HGPORT/ | |
|
173 | pulling from http://localhost:$HGPORT/ | |
|
174 | searching for changes | |
|
175 | no changes found | |
|
176 | not updating divergent bookmark X | |
|
177 | importing bookmark Z | |
|
178 | ||
|
179 | $ kill `cat ../hg.pid` |
@@ -1,233 +1,291 b'' | |||
|
1 | 1 | |
|
2 | 2 | $ cp "$TESTDIR"/printenv.py . |
|
3 | 3 | |
|
4 | 4 | This test tries to exercise the ssh functionality with a dummy script |
|
5 | 5 | |
|
6 | 6 | $ cat <<EOF > dummyssh |
|
7 | 7 | > import sys |
|
8 | 8 | > import os |
|
9 | 9 | > |
|
10 | 10 | > os.chdir(os.path.dirname(sys.argv[0])) |
|
11 | 11 | > if sys.argv[1] != "user@dummy": |
|
12 | 12 | > sys.exit(-1) |
|
13 | 13 | > |
|
14 | 14 | > if not os.path.exists("dummyssh"): |
|
15 | 15 | > sys.exit(-1) |
|
16 | 16 | > |
|
17 | 17 | > os.environ["SSH_CLIENT"] = "127.0.0.1 1 2" |
|
18 | 18 | > |
|
19 | 19 | > log = open("dummylog", "ab") |
|
20 | 20 | > log.write("Got arguments") |
|
21 | 21 | > for i, arg in enumerate(sys.argv[1:]): |
|
22 | 22 | > log.write(" %d:%s" % (i+1, arg)) |
|
23 | 23 | > log.write("\n") |
|
24 | 24 | > log.close() |
|
25 | 25 | > r = os.system(sys.argv[2]) |
|
26 | 26 | > sys.exit(bool(r)) |
|
27 | 27 | > EOF |
|
28 | 28 | $ cat <<EOF > badhook |
|
29 | 29 | > import sys |
|
30 | 30 | > sys.stdout.write("KABOOM\n") |
|
31 | 31 | > EOF |
|
32 | 32 | |
|
33 | 33 | creating 'remote |
|
34 | 34 | |
|
35 | 35 | $ hg init remote |
|
36 | 36 | $ cd remote |
|
37 | 37 | $ echo this > foo |
|
38 | 38 | $ echo this > fooO |
|
39 | 39 | $ hg ci -A -m "init" foo fooO |
|
40 |
$ echo |
|
|
41 | $ echo 'uncompressed = True' >> .hg/hgrc | |
|
42 | $ echo '[hooks]' >> .hg/hgrc | |
|
43 | $ echo 'changegroup = python ../printenv.py changegroup-in-remote 0 ../dummylog' >> .hg/hgrc | |
|
40 | $ echo <<EOF > .hg/hgrc | |
|
41 | > [server] | |
|
42 | > uncompressed = True | |
|
43 | > | |
|
44 | > [extensions] | |
|
45 | > bookmarks = | |
|
46 | > | |
|
47 | > [hooks] | |
|
48 | > changegroup = python ../printenv.py changegroup-in-remote 0 ../dummylog | |
|
49 | > EOF | |
|
44 | 50 | $ cd .. |
|
45 | 51 | |
|
46 | 52 | repo not found error |
|
47 | 53 | |
|
48 | 54 | $ hg clone -e "python ./dummyssh" ssh://user@dummy/nonexistent local |
|
49 | 55 | remote: abort: There is no Mercurial repository here (.hg not found)! |
|
50 | 56 | abort: no suitable response from remote hg! |
|
51 | 57 | [255] |
|
52 | 58 | |
|
53 | 59 | non-existent absolute path |
|
54 | 60 | |
|
55 | 61 | $ hg clone -e "python ./dummyssh" ssh://user@dummy//`pwd`/nonexistent local |
|
56 | 62 | remote: abort: There is no Mercurial repository here (.hg not found)! |
|
57 | 63 | abort: no suitable response from remote hg! |
|
58 | 64 | [255] |
|
59 | 65 | |
|
60 | 66 | clone remote via stream |
|
61 | 67 | |
|
62 | 68 | $ hg clone -e "python ./dummyssh" --uncompressed ssh://user@dummy/remote local-stream |
|
63 | 69 | streaming all changes |
|
64 | 70 | 4 files to transfer, 392 bytes of data |
|
65 | 71 | transferred 392 bytes in * seconds (*/sec) (glob) |
|
66 | 72 | updating to branch default |
|
67 | 73 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
68 | 74 | $ cd local-stream |
|
69 | 75 | $ hg verify |
|
70 | 76 | checking changesets |
|
71 | 77 | checking manifests |
|
72 | 78 | crosschecking files in changesets and manifests |
|
73 | 79 | checking files |
|
74 | 80 | 2 files, 1 changesets, 2 total revisions |
|
75 | 81 | $ cd .. |
|
76 | 82 | |
|
77 | 83 | clone remote via pull |
|
78 | 84 | |
|
79 | 85 | $ hg clone -e "python ./dummyssh" ssh://user@dummy/remote local |
|
80 | 86 | requesting all changes |
|
81 | 87 | adding changesets |
|
82 | 88 | adding manifests |
|
83 | 89 | adding file changes |
|
84 | 90 | added 1 changesets with 2 changes to 2 files |
|
85 | 91 | updating to branch default |
|
86 | 92 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
87 | 93 | |
|
88 | 94 | verify |
|
89 | 95 | |
|
90 | 96 | $ cd local |
|
91 | 97 | $ hg verify |
|
92 | 98 | checking changesets |
|
93 | 99 | checking manifests |
|
94 | 100 | crosschecking files in changesets and manifests |
|
95 | 101 | checking files |
|
96 | 102 | 2 files, 1 changesets, 2 total revisions |
|
97 | 103 | $ echo '[hooks]' >> .hg/hgrc |
|
98 | 104 | $ echo 'changegroup = python ../printenv.py changegroup-in-local 0 ../dummylog' >> .hg/hgrc |
|
99 | 105 | |
|
100 | 106 | empty default pull |
|
101 | 107 | |
|
102 | 108 | $ hg paths |
|
103 | 109 | default = ssh://user@dummy/remote |
|
104 | 110 | $ hg pull -e "python ../dummyssh" |
|
105 | 111 | pulling from ssh://user@dummy/remote |
|
106 | 112 | searching for changes |
|
107 | 113 | no changes found |
|
108 | 114 | |
|
109 | 115 | local change |
|
110 | 116 | |
|
111 | 117 | $ echo bleah > foo |
|
112 | 118 | $ hg ci -m "add" |
|
113 | 119 | |
|
114 | 120 | updating rc |
|
115 | 121 | |
|
116 | 122 | $ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc |
|
117 | 123 | $ echo "[ui]" >> .hg/hgrc |
|
118 | 124 | $ echo "ssh = python ../dummyssh" >> .hg/hgrc |
|
125 | $ echo '[extensions]' >> .hg/hgrc | |
|
126 | $ echo 'bookmarks =' >> .hg/hgrc | |
|
119 | 127 | |
|
120 | 128 | find outgoing |
|
121 | 129 | |
|
122 | 130 | $ hg out ssh://user@dummy/remote |
|
123 | 131 | comparing with ssh://user@dummy/remote |
|
124 | 132 | searching for changes |
|
125 | 133 | changeset: 1:a28a9d1a809c |
|
126 | 134 | tag: tip |
|
127 | 135 | user: test |
|
128 | 136 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
129 | 137 | summary: add |
|
130 | 138 | |
|
131 | 139 | |
|
132 | 140 | find incoming on the remote side |
|
133 | 141 | |
|
134 | 142 | $ hg incoming -R ../remote -e "python ../dummyssh" ssh://user@dummy/local |
|
135 | 143 | comparing with ssh://user@dummy/local |
|
136 | 144 | searching for changes |
|
137 | 145 | changeset: 1:a28a9d1a809c |
|
138 | 146 | tag: tip |
|
139 | 147 | user: test |
|
140 | 148 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
141 | 149 | summary: add |
|
142 | 150 | |
|
143 | 151 | |
|
144 | 152 | find incoming on the remote side (using absolute path) |
|
145 | 153 | |
|
146 | 154 | $ hg incoming -R ../remote -e "python ../dummyssh" "ssh://user@dummy/`pwd`" |
|
147 | 155 | comparing with ssh://user@dummy/$TESTTMP/local |
|
148 | 156 | searching for changes |
|
149 | 157 | changeset: 1:a28a9d1a809c |
|
150 | 158 | tag: tip |
|
151 | 159 | user: test |
|
152 | 160 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
153 | 161 | summary: add |
|
154 | 162 | |
|
155 | 163 | |
|
156 | 164 | push |
|
157 | 165 | |
|
158 | 166 | $ hg push |
|
159 | 167 | pushing to ssh://user@dummy/remote |
|
160 | 168 | searching for changes |
|
161 | 169 | remote: adding changesets |
|
162 | 170 | remote: adding manifests |
|
163 | 171 | remote: adding file changes |
|
164 | 172 | remote: added 1 changesets with 1 changes to 1 files |
|
165 | 173 | $ cd ../remote |
|
166 | 174 | |
|
167 | 175 | check remote tip |
|
168 | 176 | |
|
169 | 177 | $ hg tip |
|
170 | 178 | changeset: 1:a28a9d1a809c |
|
171 | 179 | tag: tip |
|
172 | 180 | user: test |
|
173 | 181 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
174 | 182 | summary: add |
|
175 | 183 | |
|
176 | 184 | $ hg verify |
|
177 | 185 | checking changesets |
|
178 | 186 | checking manifests |
|
179 | 187 | crosschecking files in changesets and manifests |
|
180 | 188 | checking files |
|
181 | 189 | 2 files, 2 changesets, 3 total revisions |
|
182 | 190 | $ hg cat -r tip foo |
|
183 | 191 | bleah |
|
184 | 192 | $ echo z > z |
|
185 | 193 | $ hg ci -A -m z z |
|
186 | 194 | created new head |
|
187 | 195 | |
|
196 | test pushkeys and bookmarks | |
|
197 | ||
|
198 | $ cd ../local | |
|
199 | $ echo '[extensions]' >> ../remote/.hg/hgrc | |
|
200 | $ echo 'bookmarks =' >> ../remote/.hg/hgrc | |
|
201 | $ hg debugpushkey --config ui.ssh="python ../dummyssh" ssh://user@dummy/remote namespaces | |
|
202 | bookmarks | |
|
203 | namespaces | |
|
204 | $ hg book foo -r 0 | |
|
205 | $ hg out -B | |
|
206 | comparing with ssh://user@dummy/remote | |
|
207 | searching for changed bookmarks | |
|
208 | foo 1160648e36ce | |
|
209 | $ hg push -B foo | |
|
210 | pushing to ssh://user@dummy/remote | |
|
211 | searching for changes | |
|
212 | no changes found | |
|
213 | exporting bookmark foo | |
|
214 | $ hg debugpushkey --config ui.ssh="python ../dummyssh" ssh://user@dummy/remote bookmarks | |
|
215 | foo 1160648e36cec0054048a7edc4110c6f84fde594 | |
|
216 | $ hg book -f foo | |
|
217 | $ hg push | |
|
218 | pushing to ssh://user@dummy/remote | |
|
219 | searching for changes | |
|
220 | no changes found | |
|
221 | updating bookmark foo | |
|
222 | $ hg book -d foo | |
|
223 | $ hg in -B | |
|
224 | comparing with ssh://user@dummy/remote | |
|
225 | searching for changed bookmarks | |
|
226 | foo a28a9d1a809c | |
|
227 | $ hg book -f -r 0 foo | |
|
228 | $ hg pull -B foo | |
|
229 | pulling from ssh://user@dummy/remote | |
|
230 | searching for changes | |
|
231 | no changes found | |
|
232 | updating bookmark foo | |
|
233 | importing bookmark foo | |
|
234 | $ hg book -d foo | |
|
235 | $ hg push -B foo | |
|
236 | deleting remote bookmark foo | |
|
237 | ||
|
188 | 238 | a bad, evil hook that prints to stdout |
|
189 | 239 | |
|
190 | $ echo 'changegroup.stdout = python ../badhook' >> .hg/hgrc | |
|
191 | $ cd ../local | |
|
240 | $ echo '[hooks]' >> ../remote/.hg/hgrc | |
|
241 | $ echo 'changegroup.stdout = python ../badhook' >> ../remote/.hg/hgrc | |
|
192 | 242 | $ echo r > r |
|
193 | 243 | $ hg ci -A -m z r |
|
194 | 244 | |
|
195 | 245 | push should succeed even though it has an unexpected response |
|
196 | 246 | |
|
197 | 247 | $ hg push |
|
198 | 248 | pushing to ssh://user@dummy/remote |
|
199 | 249 | searching for changes |
|
200 | 250 | note: unsynced remote changes! |
|
201 | 251 | remote: adding changesets |
|
202 | 252 | remote: adding manifests |
|
203 | 253 | remote: adding file changes |
|
204 | 254 | remote: added 1 changesets with 1 changes to 1 files |
|
205 | 255 | remote: KABOOM |
|
206 | 256 | $ hg -R ../remote heads |
|
207 | 257 | changeset: 3:1383141674ec |
|
208 | 258 | tag: tip |
|
209 | 259 | parent: 1:a28a9d1a809c |
|
210 | 260 | user: test |
|
211 | 261 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
212 | 262 | summary: z |
|
213 | 263 | |
|
214 | 264 | changeset: 2:6c0482d977a3 |
|
215 | 265 | parent: 0:1160648e36ce |
|
216 | 266 | user: test |
|
217 | 267 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
218 | 268 | summary: z |
|
219 | 269 | |
|
220 | 270 | $ cd .. |
|
221 | 271 | $ cat dummylog |
|
222 | 272 | Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio |
|
223 | 273 | Got arguments 1:user@dummy 2:hg -R /$TESTTMP/nonexistent serve --stdio |
|
224 | 274 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
225 | 275 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
226 | 276 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
227 | 277 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
228 | 278 | Got arguments 1:user@dummy 2:hg -R local serve --stdio |
|
229 | 279 | Got arguments 1:user@dummy 2:hg -R $TESTTMP/local serve --stdio |
|
230 | 280 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
231 | changegroup-in-remote hook: HG_NODE=a28a9d1a809cab7d4e2fde4bee738a9ede948b60 HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1 | |
|
281 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio | |
|
282 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio | |
|
283 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio | |
|
284 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio | |
|
285 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio | |
|
232 | 286 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
233 | changegroup-in-remote hook: HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6 HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1 | |
|
287 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio | |
|
288 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio | |
|
289 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio | |
|
290 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio | |
|
291 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
General Comments 0
You need to be logged in to leave comments.
Login now