Show More
@@ -0,0 +1,44 b'' | |||||
|
1 | #!/bin/sh | |||
|
2 | ||||
|
3 | echo '[extensions]' >> $HGRCPATH | |||
|
4 | echo 'hgext.mq =' >> $HGRCPATH | |||
|
5 | ||||
|
6 | hg init repo | |||
|
7 | cd repo | |||
|
8 | ||||
|
9 | echo foo > foo | |||
|
10 | hg ci -qAm 'add a file' | |||
|
11 | ||||
|
12 | hg qinit | |||
|
13 | ||||
|
14 | hg qnew foo | |||
|
15 | echo foo >> foo | |||
|
16 | hg qrefresh -m 'append foo' | |||
|
17 | ||||
|
18 | hg qnew bar | |||
|
19 | echo bar >> foo | |||
|
20 | hg qrefresh -m 'append bar' | |||
|
21 | ||||
|
22 | echo '% try to commit on top of a patch' | |||
|
23 | echo quux >> foo | |||
|
24 | hg ci -m 'append quux' | |||
|
25 | ||||
|
26 | # cheat a bit... | |||
|
27 | mv .hg/patches .hg/patches2 | |||
|
28 | hg ci -m 'append quux' | |||
|
29 | mv .hg/patches2 .hg/patches | |||
|
30 | ||||
|
31 | echo '% qpop/qrefresh on the wrong revision' | |||
|
32 | hg qpop | |||
|
33 | hg qpop -n patches 2>&1 | sed -e 's/\(using patch queue:\).*/\1/' | |||
|
34 | hg qrefresh | |||
|
35 | ||||
|
36 | hg up -C qtip | |||
|
37 | echo '% qpop' | |||
|
38 | hg qpop | |||
|
39 | ||||
|
40 | echo '% qrefresh' | |||
|
41 | hg qrefresh | |||
|
42 | ||||
|
43 | echo '% tip:' | |||
|
44 | hg tip --template '#rev# #desc#\n' |
@@ -0,0 +1,14 b'' | |||||
|
1 | % try to commit on top of a patch | |||
|
2 | abort: cannot commit over an applied mq patch | |||
|
3 | % qpop/qrefresh on the wrong revision | |||
|
4 | abort: working directory revision is not qtip | |||
|
5 | using patch queue: | |||
|
6 | abort: popping would remove a revision not managed by this patch queue | |||
|
7 | abort: working directory revision is not qtip | |||
|
8 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
9 | % qpop | |||
|
10 | abort: popping would remove a revision not managed by this patch queue | |||
|
11 | % qrefresh | |||
|
12 | abort: cannot refresh a revision with children | |||
|
13 | % tip: | |||
|
14 | 3 append quux |
@@ -30,8 +30,8 b" SKIPREV = 'SKIP'" | |||||
30 | class commit(object): |
|
30 | class commit(object): | |
31 | def __init__(self, author, date, desc, parents, branch=None, rev=None, |
|
31 | def __init__(self, author, date, desc, parents, branch=None, rev=None, | |
32 | extra={}): |
|
32 | extra={}): | |
33 | self.author = author |
|
33 | self.author = author or 'unknown' | |
34 | self.date = date |
|
34 | self.date = date or '0 0' | |
35 | self.desc = desc |
|
35 | self.desc = desc | |
36 | self.parents = parents |
|
36 | self.parents = parents | |
37 | self.branch = branch |
|
37 | self.branch = branch |
@@ -102,7 +102,6 b' class convert_git(converter_source):' | |||||
102 | tzs, tzh, tzm = tz[-5:-4] + "1", tz[-4:-2], tz[-2:] |
|
102 | tzs, tzh, tzm = tz[-5:-4] + "1", tz[-4:-2], tz[-2:] | |
103 | tz = -int(tzs) * (int(tzh) * 3600 + int(tzm)) |
|
103 | tz = -int(tzs) * (int(tzh) * 3600 + int(tzm)) | |
104 | date = tm + " " + str(tz) |
|
104 | date = tm + " " + str(tz) | |
105 | author = author or "unknown" |
|
|||
106 |
|
105 | |||
107 | c = commit(parents=parents, date=date, author=author, desc=message, |
|
106 | c = commit(parents=parents, date=date, author=author, desc=message, | |
108 | rev=version) |
|
107 | rev=version) |
@@ -600,11 +600,19 b' class queue:' | |||||
600 | raise util.Abort(_("local changes found")) |
|
600 | raise util.Abort(_("local changes found")) | |
601 | return m, a, r, d |
|
601 | return m, a, r, d | |
602 |
|
602 | |||
|
603 | _reserved = ('series', 'status', 'guards') | |||
|
604 | def check_reserved_name(self, name): | |||
|
605 | if (name in self._reserved or name.startswith('.hg') | |||
|
606 | or name.startswith('.mq')): | |||
|
607 | raise util.Abort(_('"%s" cannot be used as the name of a patch') | |||
|
608 | % name) | |||
|
609 | ||||
603 | def new(self, repo, patch, *pats, **opts): |
|
610 | def new(self, repo, patch, *pats, **opts): | |
604 | msg = opts.get('msg') |
|
611 | msg = opts.get('msg') | |
605 | force = opts.get('force') |
|
612 | force = opts.get('force') | |
606 | user = opts.get('user') |
|
613 | user = opts.get('user') | |
607 | date = opts.get('date') |
|
614 | date = opts.get('date') | |
|
615 | self.check_reserved_name(patch) | |||
608 | if os.path.exists(self.join(patch)): |
|
616 | if os.path.exists(self.join(patch)): | |
609 | raise util.Abort(_('patch "%s" already exists') % patch) |
|
617 | raise util.Abort(_('patch "%s" already exists') % patch) | |
610 | if opts.get('include') or opts.get('exclude') or pats: |
|
618 | if opts.get('include') or opts.get('exclude') or pats: | |
@@ -872,10 +880,16 b' class queue:' | |||||
872 | start = info[0] |
|
880 | start = info[0] | |
873 | rev = revlog.bin(info[1]) |
|
881 | rev = revlog.bin(info[1]) | |
874 |
|
882 | |||
|
883 | if update: | |||
|
884 | top = self.check_toppatch(repo) | |||
|
885 | ||||
|
886 | if repo.changelog.heads(rev) != [revlog.bin(self.applied[-1].rev)]: | |||
|
887 | raise util.Abort("popping would remove a revision not " | |||
|
888 | "managed by this patch queue") | |||
|
889 | ||||
875 | # we know there are no local changes, so we can make a simplified |
|
890 | # we know there are no local changes, so we can make a simplified | |
876 | # form of hg.update. |
|
891 | # form of hg.update. | |
877 | if update: |
|
892 | if update: | |
878 | top = self.check_toppatch(repo) |
|
|||
879 | qp = self.qparents(repo, rev) |
|
893 | qp = self.qparents(repo, rev) | |
880 | changes = repo.changelog.read(qp) |
|
894 | changes = repo.changelog.read(qp) | |
881 | mmap = repo.manifest.read(changes[0]) |
|
895 | mmap = repo.manifest.read(changes[0]) | |
@@ -898,8 +912,8 b' class queue:' | |||||
898 | except: pass |
|
912 | except: pass | |
899 | repo.dirstate.forget(f) |
|
913 | repo.dirstate.forget(f) | |
900 | repo.dirstate.setparents(qp, revlog.nullid) |
|
914 | repo.dirstate.setparents(qp, revlog.nullid) | |
|
915 | del self.applied[start:end] | |||
901 | self.strip(repo, rev, update=False, backup='strip') |
|
916 | self.strip(repo, rev, update=False, backup='strip') | |
902 | del self.applied[start:end] |
|
|||
903 | if len(self.applied): |
|
917 | if len(self.applied): | |
904 | self.ui.write("Now at: %s\n" % self.applied[-1].name) |
|
918 | self.ui.write("Now at: %s\n" % self.applied[-1].name) | |
905 | else: |
|
919 | else: | |
@@ -926,6 +940,8 b' class queue:' | |||||
926 | self.check_toppatch(repo) |
|
940 | self.check_toppatch(repo) | |
927 | (top, patchfn) = (self.applied[-1].rev, self.applied[-1].name) |
|
941 | (top, patchfn) = (self.applied[-1].rev, self.applied[-1].name) | |
928 | top = revlog.bin(top) |
|
942 | top = revlog.bin(top) | |
|
943 | if repo.changelog.heads(top) != [top]: | |||
|
944 | raise util.Abort("cannot refresh a revision with children") | |||
929 | cparents = repo.changelog.parents(top) |
|
945 | cparents = repo.changelog.parents(top) | |
930 | patchparent = self.qparents(repo, top) |
|
946 | patchparent = self.qparents(repo, top) | |
931 | message, comments, user, date, patchfound = self.readheaders(patchfn) |
|
947 | message, comments, user, date, patchfound = self.readheaders(patchfn) | |
@@ -1112,12 +1128,13 b' class queue:' | |||||
1112 | if not user: |
|
1128 | if not user: | |
1113 | user = changes[1] |
|
1129 | user = changes[1] | |
1114 |
|
1130 | |||
|
1131 | self.applied.pop() | |||
|
1132 | self.applied_dirty = 1 | |||
1115 | self.strip(repo, top, update=False, |
|
1133 | self.strip(repo, top, update=False, | |
1116 | backup='strip') |
|
1134 | backup='strip') | |
1117 | n = repo.commit(filelist, message, user, date, match=matchfn, |
|
1135 | n = repo.commit(filelist, message, user, date, match=matchfn, | |
1118 | force=1) |
|
1136 | force=1) | |
1119 |
self.applied |
|
1137 | self.applied.append(statusentry(revlog.hex(n), patchfn)) | |
1120 | self.applied_dirty = 1 |
|
|||
1121 | self.removeundo(repo) |
|
1138 | self.removeundo(repo) | |
1122 | else: |
|
1139 | else: | |
1123 | self.printdiff(repo, patchparent, fp=patchf) |
|
1140 | self.printdiff(repo, patchparent, fp=patchf) | |
@@ -1406,6 +1423,7 b' class queue:' | |||||
1406 |
|
1423 | |||
1407 | if not patchname: |
|
1424 | if not patchname: | |
1408 | patchname = normname('%d.diff' % r) |
|
1425 | patchname = normname('%d.diff' % r) | |
|
1426 | self.check_reserved_name(patchname) | |||
1409 | checkseries(patchname) |
|
1427 | checkseries(patchname) | |
1410 | checkfile(patchname) |
|
1428 | checkfile(patchname) | |
1411 | self.full_series.insert(0, patchname) |
|
1429 | self.full_series.insert(0, patchname) | |
@@ -1428,6 +1446,7 b' class queue:' | |||||
1428 | raise util.Abort(_('-e is incompatible with import from -')) |
|
1446 | raise util.Abort(_('-e is incompatible with import from -')) | |
1429 | if not patchname: |
|
1447 | if not patchname: | |
1430 | patchname = normname(filename) |
|
1448 | patchname = normname(filename) | |
|
1449 | self.check_reserved_name(patchname) | |||
1431 | if not os.path.isfile(self.join(patchname)): |
|
1450 | if not os.path.isfile(self.join(patchname)): | |
1432 | raise util.Abort(_("patch %s does not exist") % patchname) |
|
1451 | raise util.Abort(_("patch %s does not exist") % patchname) | |
1433 | else: |
|
1452 | else: | |
@@ -1442,6 +1461,7 b' class queue:' | |||||
1442 | raise util.Abort(_("unable to read %s") % patchname) |
|
1461 | raise util.Abort(_("unable to read %s") % patchname) | |
1443 | if not patchname: |
|
1462 | if not patchname: | |
1444 | patchname = normname(os.path.basename(filename)) |
|
1463 | patchname = normname(os.path.basename(filename)) | |
|
1464 | self.check_reserved_name(patchname) | |||
1445 | checkfile(patchname) |
|
1465 | checkfile(patchname) | |
1446 | patchf = self.opener(patchname, "w") |
|
1466 | patchf = self.opener(patchname, "w") | |
1447 | patchf.write(text) |
|
1467 | patchf.write(text) | |
@@ -2147,6 +2167,12 b' def reposetup(ui, repo):' | |||||
2147 | return tagscache |
|
2167 | return tagscache | |
2148 |
|
2168 | |||
2149 | mqtags = [(revlog.bin(patch.rev), patch.name) for patch in q.applied] |
|
2169 | mqtags = [(revlog.bin(patch.rev), patch.name) for patch in q.applied] | |
|
2170 | ||||
|
2171 | if mqtags[-1][0] not in self.changelog.nodemap: | |||
|
2172 | self.ui.warn('mq status file refers to unknown node %s\n' | |||
|
2173 | % revlog.short(mqtags[-1][0])) | |||
|
2174 | return tagscache | |||
|
2175 | ||||
2150 | mqtags.append((mqtags[-1][0], 'qtip')) |
|
2176 | mqtags.append((mqtags[-1][0], 'qtip')) | |
2151 | mqtags.append((mqtags[0][0], 'qbase')) |
|
2177 | mqtags.append((mqtags[0][0], 'qbase')) | |
2152 | mqtags.append((self.changelog.parents(mqtags[0][0])[0], 'qparent')) |
|
2178 | mqtags.append((self.changelog.parents(mqtags[0][0])[0], 'qparent')) | |
@@ -2163,11 +2189,17 b' def reposetup(ui, repo):' | |||||
2163 | if not q.applied: |
|
2189 | if not q.applied: | |
2164 | return super(mqrepo, self)._branchtags() |
|
2190 | return super(mqrepo, self)._branchtags() | |
2165 |
|
2191 | |||
|
2192 | cl = self.changelog | |||
|
2193 | qbasenode = revlog.bin(q.applied[0].rev) | |||
|
2194 | if qbasenode not in cl.nodemap: | |||
|
2195 | self.ui.warn('mq status file refers to unknown node %s\n' | |||
|
2196 | % revlog.short(qbasenode)) | |||
|
2197 | return super(mqrepo, self)._branchtags() | |||
|
2198 | ||||
2166 | self.branchcache = {} # avoid recursion in changectx |
|
2199 | self.branchcache = {} # avoid recursion in changectx | |
2167 | cl = self.changelog |
|
|||
2168 | partial, last, lrev = self._readbranchcache() |
|
2200 | partial, last, lrev = self._readbranchcache() | |
2169 |
|
2201 | |||
2170 |
qbase = cl.rev( |
|
2202 | qbase = cl.rev(qbasenode) | |
2171 | start = lrev + 1 |
|
2203 | start = lrev + 1 | |
2172 | if start < qbase: |
|
2204 | if start < qbase: | |
2173 | # update the cache (excluding the patches) and save it |
|
2205 | # update the cache (excluding the patches) and save it |
@@ -1540,6 +1540,9 b' def import_(ui, repo, patch1, *patches, ' | |||||
1540 | repo.rollback() |
|
1540 | repo.rollback() | |
1541 | raise util.Abort(_('patch is damaged' |
|
1541 | raise util.Abort(_('patch is damaged' | |
1542 | ' or loses information')) |
|
1542 | ' or loses information')) | |
|
1543 | # Force a dirstate write so that the next transaction | |||
|
1544 | # backups an up-do-date file. | |||
|
1545 | repo.dirstate.write() | |||
1543 | finally: |
|
1546 | finally: | |
1544 | os.unlink(tmpname) |
|
1547 | os.unlink(tmpname) | |
1545 | finally: |
|
1548 | finally: |
@@ -103,10 +103,13 b' class httpconnection(keepalive.HTTPConne' | |||||
103 | # must be able to send big bundle as stream. |
|
103 | # must be able to send big bundle as stream. | |
104 | send = _gen_sendfile(keepalive.HTTPConnection) |
|
104 | send = _gen_sendfile(keepalive.HTTPConnection) | |
105 |
|
105 | |||
106 |
class |
|
106 | class httphandler(keepalive.HTTPHandler): | |
107 | def http_open(self, req): |
|
107 | def http_open(self, req): | |
108 | return self.do_open(httpconnection, req) |
|
108 | return self.do_open(httpconnection, req) | |
109 |
|
109 | |||
|
110 | def __del__(self): | |||
|
111 | self.close_all() | |||
|
112 | ||||
110 | has_https = hasattr(urllib2, 'HTTPSHandler') |
|
113 | has_https = hasattr(urllib2, 'HTTPSHandler') | |
111 | if has_https: |
|
114 | if has_https: | |
112 | class httpsconnection(httplib.HTTPSConnection): |
|
115 | class httpsconnection(httplib.HTTPSConnection): | |
@@ -114,12 +117,9 b' if has_https:' | |||||
114 | # must be able to send big bundle as stream. |
|
117 | # must be able to send big bundle as stream. | |
115 | send = _gen_sendfile(httplib.HTTPSConnection) |
|
118 | send = _gen_sendfile(httplib.HTTPSConnection) | |
116 |
|
119 | |||
117 |
class httphandler( |
|
120 | class httpshandler(keepalive.KeepAliveHandler, urllib2.HTTPSHandler): | |
118 | def https_open(self, req): |
|
121 | def https_open(self, req): | |
119 | return self.do_open(httpsconnection, req) |
|
122 | return self.do_open(httpsconnection, req) | |
120 | else: |
|
|||
121 | class httphandler(basehttphandler): |
|
|||
122 | pass |
|
|||
123 |
|
123 | |||
124 | # In python < 2.5 AbstractDigestAuthHandler raises a ValueError if |
|
124 | # In python < 2.5 AbstractDigestAuthHandler raises a ValueError if | |
125 | # it doesn't know about the auth type requested. This can happen if |
|
125 | # it doesn't know about the auth type requested. This can happen if | |
@@ -203,8 +203,9 b' class httprepository(remoterepository):' | |||||
203 |
|
203 | |||
204 | proxyurl = ui.config("http_proxy", "host") or os.getenv('http_proxy') |
|
204 | proxyurl = ui.config("http_proxy", "host") or os.getenv('http_proxy') | |
205 | # XXX proxyauthinfo = None |
|
205 | # XXX proxyauthinfo = None | |
206 |
|
|
206 | handlers = [httphandler()] | |
207 | handlers = [self.handler] |
|
207 | if has_https: | |
|
208 | handlers.append(httpshandler()) | |||
208 |
|
209 | |||
209 | if proxyurl: |
|
210 | if proxyurl: | |
210 | # proxy can be proper url or host[:port] |
|
211 | # proxy can be proper url or host[:port] | |
@@ -270,11 +271,6 b' class httprepository(remoterepository):' | |||||
270 | opener.addheaders = [('User-agent', 'mercurial/proto-1.0')] |
|
271 | opener.addheaders = [('User-agent', 'mercurial/proto-1.0')] | |
271 | urllib2.install_opener(opener) |
|
272 | urllib2.install_opener(opener) | |
272 |
|
273 | |||
273 | def __del__(self): |
|
|||
274 | if self.handler: |
|
|||
275 | self.handler.close_all() |
|
|||
276 | self.handler = None |
|
|||
277 |
|
||||
278 | def url(self): |
|
274 | def url(self): | |
279 | return self.path |
|
275 | return self.path | |
280 |
|
276 |
@@ -175,7 +175,7 b' class ConnectionManager:' | |||||
175 | else: |
|
175 | else: | |
176 | return dict(self._hostmap) |
|
176 | return dict(self._hostmap) | |
177 |
|
177 | |||
178 | class HTTPHandler(urllib2.HTTPHandler): |
|
178 | class KeepAliveHandler: | |
179 | def __init__(self): |
|
179 | def __init__(self): | |
180 | self._cm = ConnectionManager() |
|
180 | self._cm = ConnectionManager() | |
181 |
|
181 | |||
@@ -314,6 +314,9 b' class HTTPHandler(urllib2.HTTPHandler):' | |||||
314 | except socket.error, err: # XXX what error? |
|
314 | except socket.error, err: # XXX what error? | |
315 | raise urllib2.URLError(err) |
|
315 | raise urllib2.URLError(err) | |
316 |
|
316 | |||
|
317 | class HTTPHandler(KeepAliveHandler, urllib2.HTTPHandler): | |||
|
318 | pass | |||
|
319 | ||||
317 | class HTTPResponse(httplib.HTTPResponse): |
|
320 | class HTTPResponse(httplib.HTTPResponse): | |
318 | # we need to subclass HTTPResponse in order to |
|
321 | # we need to subclass HTTPResponse in order to | |
319 | # 1) add readline() and readlines() methods |
|
322 | # 1) add readline() and readlines() methods |
@@ -120,6 +120,7 b' class localrepository(repo.repository):' | |||||
120 | self.hook('pretag', throw=True, node=hex(node), tag=name, local=local) |
|
120 | self.hook('pretag', throw=True, node=hex(node), tag=name, local=local) | |
121 |
|
121 | |||
122 | def writetag(fp, name, munge, prevtags): |
|
122 | def writetag(fp, name, munge, prevtags): | |
|
123 | fp.seek(0, 2) | |||
123 | if prevtags and prevtags[-1] != '\n': |
|
124 | if prevtags and prevtags[-1] != '\n': | |
124 | fp.write('\n') |
|
125 | fp.write('\n') | |
125 | fp.write('%s %s\n' % (hex(node), munge and munge(name) or name)) |
|
126 | fp.write('%s %s\n' % (hex(node), munge and munge(name) or name)) | |
@@ -1981,6 +1982,10 b' class localrepository(repo.repository):' | |||||
1981 | del tr |
|
1982 | del tr | |
1982 |
|
1983 | |||
1983 | if changesets > 0: |
|
1984 | if changesets > 0: | |
|
1985 | # forcefully update the on-disk branch cache | |||
|
1986 | self.ui.debug(_("updating the branch cache\n")) | |||
|
1987 | self.branchcache = None | |||
|
1988 | self.branchtags() | |||
1984 | self.hook("changegroup", node=hex(self.changelog.node(cor+1)), |
|
1989 | self.hook("changegroup", node=hex(self.changelog.node(cor+1)), | |
1985 | source=srctype, url=url) |
|
1990 | source=srctype, url=url) | |
1986 |
|
1991 |
@@ -114,14 +114,25 b' class sshrepository(remoterepository):' | |||||
114 | return self.pipei |
|
114 | return self.pipei | |
115 |
|
115 | |||
116 | def call(self, cmd, **args): |
|
116 | def call(self, cmd, **args): | |
117 |
|
|
117 | self.do_cmd(cmd, **args) | |
118 | l = r.readline() |
|
118 | return self._recv() | |
|
119 | ||||
|
120 | def _recv(self): | |||
|
121 | l = self.pipei.readline() | |||
119 | self.readerr() |
|
122 | self.readerr() | |
120 | try: |
|
123 | try: | |
121 | l = int(l) |
|
124 | l = int(l) | |
122 | except: |
|
125 | except: | |
123 | self.raise_(util.UnexpectedOutput(_("unexpected response:"), l)) |
|
126 | self.raise_(util.UnexpectedOutput(_("unexpected response:"), l)) | |
124 |
return |
|
127 | return self.pipei.read(l) | |
|
128 | ||||
|
129 | def _send(self, data, flush=False): | |||
|
130 | self.pipeo.write("%d\n" % len(data)) | |||
|
131 | if data: | |||
|
132 | self.pipeo.write(data) | |||
|
133 | if flush: | |||
|
134 | self.pipeo.flush() | |||
|
135 | self.readerr() | |||
125 |
|
136 | |||
126 | def lock(self): |
|
137 | def lock(self): | |
127 | self.call("lock") |
|
138 | self.call("lock") | |
@@ -182,25 +193,22 b' class sshrepository(remoterepository):' | |||||
182 |
|
193 | |||
183 | while 1: |
|
194 | while 1: | |
184 | d = cg.read(4096) |
|
195 | d = cg.read(4096) | |
185 |
if not d: |
|
196 | if not d: | |
186 | self.pipeo.write(str(len(d)) + '\n') |
|
197 | break | |
187 |
self. |
|
198 | self._send(d) | |
188 | self.readerr() |
|
|||
189 |
|
199 | |||
190 | self.pipeo.write('0\n') |
|
200 | self._send("", flush=True) | |
191 | self.pipeo.flush() |
|
|||
192 |
|
201 | |||
193 |
self. |
|
202 | r = self._recv() | |
194 | l = int(self.pipei.readline()) |
|
|||
195 | r = self.pipei.read(l) |
|
|||
196 | if r: |
|
203 | if r: | |
197 | # remote may send "unsynced changes" |
|
204 | # remote may send "unsynced changes" | |
198 | self.raise_(repo.RepoError(_("push failed: %s") % r)) |
|
205 | self.raise_(repo.RepoError(_("push failed: %s") % r)) | |
199 |
|
206 | |||
200 |
self. |
|
207 | r = self._recv() | |
201 | l = int(self.pipei.readline()) |
|
208 | try: | |
202 | r = self.pipei.read(l) |
|
|||
203 | return int(r) |
|
209 | return int(r) | |
|
210 | except: | |||
|
211 | self.raise_(util.UnexpectedOutput(_("unexpected response:"), r)) | |||
204 |
|
212 | |||
205 | def addchangegroup(self, cg, source, url): |
|
213 | def addchangegroup(self, cg, source, url): | |
206 | d = self.call("addchangegroup") |
|
214 | d = self.call("addchangegroup") | |
@@ -208,18 +216,21 b' class sshrepository(remoterepository):' | |||||
208 | self.raise_(repo.RepoError(_("push refused: %s") % d)) |
|
216 | self.raise_(repo.RepoError(_("push refused: %s") % d)) | |
209 | while 1: |
|
217 | while 1: | |
210 | d = cg.read(4096) |
|
218 | d = cg.read(4096) | |
211 |
if not d: |
|
219 | if not d: | |
|
220 | break | |||
212 | self.pipeo.write(d) |
|
221 | self.pipeo.write(d) | |
213 | self.readerr() |
|
222 | self.readerr() | |
214 |
|
223 | |||
215 | self.pipeo.flush() |
|
224 | self.pipeo.flush() | |
216 |
|
225 | |||
217 | self.readerr() |
|
226 | self.readerr() | |
218 |
|
|
227 | r = self._recv() | |
219 | r = self.pipei.read(l) |
|
|||
220 | if not r: |
|
228 | if not r: | |
221 | return 1 |
|
229 | return 1 | |
|
230 | try: | |||
222 | return int(r) |
|
231 | return int(r) | |
|
232 | except: | |||
|
233 | self.raise_(util.UnexpectedOutput(_("unexpected response:"), r)) | |||
223 |
|
234 | |||
224 | def stream_out(self): |
|
235 | def stream_out(self): | |
225 | return self.do_cmd('stream_out') |
|
236 | return self.do_cmd('stream_out') |
@@ -1,6 +1,6 b'' | |||||
1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
|
1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
2 | <html> |
|
2 | <html> | |
3 | <head> |
|
3 | <head> | |
4 | <link rel="icon" href="#staticurl#hgicon.png" type="image/png"> |
|
4 | <link rel="icon" href="#staticurl#hgicon.png" type="image/png" /> | |
5 | <meta name="robots" content="index, nofollow" /> |
|
5 | <meta name="robots" content="index, nofollow" /> | |
6 | <link rel="stylesheet" href="#staticurl#style.css" type="text/css" /> |
|
6 | <link rel="stylesheet" href="#staticurl#style.css" type="text/css" /> |
@@ -1,6 +1,6 b'' | |||||
1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
|
1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
2 | <html> |
|
2 | <html> | |
3 | <head> |
|
3 | <head> | |
4 | <link rel="icon" href="?static=hgicon.png" type="image/png"> |
|
4 | <link rel="icon" href="?static=hgicon.png" type="image/png" /> | |
5 | <meta name="robots" content="index, nofollow" /> |
|
5 | <meta name="robots" content="index, nofollow" /> | |
6 | <link rel="stylesheet" href="?static=style.css" type="text/css" /> |
|
6 | <link rel="stylesheet" href="?static=style.css" type="text/css" /> |
@@ -28,6 +28,7 b' adding foo/Bar/file.txt revisions' | |||||
28 | adding foo/file.txt revisions |
|
28 | adding foo/file.txt revisions | |
29 | adding quux/file.py revisions |
|
29 | adding quux/file.py revisions | |
30 | added 3 changesets with 3 changes to 3 files |
|
30 | added 3 changesets with 3 changes to 3 files | |
|
31 | updating the branch cache | |||
31 | rolling back last transaction |
|
32 | rolling back last transaction | |
32 | 0:6675d58eff77 |
|
33 | 0:6675d58eff77 | |
33 |
|
34 | |||
@@ -59,6 +60,7 b' calling hook pretxnchangegroup.acl: hgex' | |||||
59 | acl: acl.allow not enabled |
|
60 | acl: acl.allow not enabled | |
60 | acl: acl.deny not enabled |
|
61 | acl: acl.deny not enabled | |
61 | acl: changes have source "push" - skipping |
|
62 | acl: changes have source "push" - skipping | |
|
63 | updating the branch cache | |||
62 | rolling back last transaction |
|
64 | rolling back last transaction | |
63 | 0:6675d58eff77 |
|
65 | 0:6675d58eff77 | |
64 |
|
66 | |||
@@ -94,6 +96,7 b' acl: acl.deny not enabled' | |||||
94 | acl: allowing changeset ef1ea85a6374 |
|
96 | acl: allowing changeset ef1ea85a6374 | |
95 | acl: allowing changeset f9cafe1212c8 |
|
97 | acl: allowing changeset f9cafe1212c8 | |
96 | acl: allowing changeset 911600dab2ae |
|
98 | acl: allowing changeset 911600dab2ae | |
|
99 | updating the branch cache | |||
97 | rolling back last transaction |
|
100 | rolling back last transaction | |
98 | 0:6675d58eff77 |
|
101 | 0:6675d58eff77 | |
99 |
|
102 | |||
@@ -383,6 +386,7 b' acl: acl.deny enabled, 0 entries for use' | |||||
383 | acl: allowing changeset ef1ea85a6374 |
|
386 | acl: allowing changeset ef1ea85a6374 | |
384 | acl: allowing changeset f9cafe1212c8 |
|
387 | acl: allowing changeset f9cafe1212c8 | |
385 | acl: allowing changeset 911600dab2ae |
|
388 | acl: allowing changeset 911600dab2ae | |
|
389 | updating the branch cache | |||
386 | rolling back last transaction |
|
390 | rolling back last transaction | |
387 | 0:6675d58eff77 |
|
391 | 0:6675d58eff77 | |
388 |
|
392 | |||
@@ -578,6 +582,7 b' acl: acl.deny enabled, 0 entries for use' | |||||
578 | acl: allowing changeset ef1ea85a6374 |
|
582 | acl: allowing changeset ef1ea85a6374 | |
579 | acl: allowing changeset f9cafe1212c8 |
|
583 | acl: allowing changeset f9cafe1212c8 | |
580 | acl: allowing changeset 911600dab2ae |
|
584 | acl: allowing changeset 911600dab2ae | |
|
585 | updating the branch cache | |||
581 | rolling back last transaction |
|
586 | rolling back last transaction | |
582 | 0:6675d58eff77 |
|
587 | 0:6675d58eff77 | |
583 |
|
588 |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -24,7 +24,7 b' 404 Not Found' | |||||
24 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
|
24 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
25 | <html> |
|
25 | <html> | |
26 | <head> |
|
26 | <head> | |
27 | <link rel="icon" href="/static/hgicon.png" type="image/png"> |
|
27 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> | |
28 | <meta name="robots" content="index, nofollow" /> |
|
28 | <meta name="robots" content="index, nofollow" /> | |
29 | <link rel="stylesheet" href="/static/style.css" type="text/css" /> |
|
29 | <link rel="stylesheet" href="/static/style.css" type="text/css" /> | |
30 |
|
30 |
@@ -125,6 +125,18 b' python mkmsg2.py | hg --cwd b import -' | |||||
125 | hg --cwd b tip --template '{desc}\n' |
|
125 | hg --cwd b tip --template '{desc}\n' | |
126 | rm -r b |
|
126 | rm -r b | |
127 |
|
127 | |||
|
128 | # We weren't backing up the correct dirstate file when importing many patches | |||
|
129 | # (issue963) | |||
|
130 | echo '% import patch1 patch2; rollback' | |||
|
131 | echo line 3 >> a/a | |||
|
132 | hg --cwd a ci -m'third change' | |||
|
133 | hg --cwd a export -o '../patch%R' 1 2 | |||
|
134 | hg clone -qr0 a b | |||
|
135 | hg --cwd b parents --template 'parent: #rev#\n' | |||
|
136 | hg --cwd b import ../patch1 ../patch2 | |||
|
137 | hg --cwd b rollback | |||
|
138 | hg --cwd b parents --template 'parent: #rev#\n' | |||
|
139 | rm -r b | |||
128 |
|
140 | |||
129 | # bug non regression test |
|
141 | # bug non regression test | |
130 | # importing a patch in a subdirectory failed at the commit stage |
|
142 | # importing a patch in a subdirectory failed at the commit stage |
@@ -152,6 +152,12 b' email patch' | |||||
152 |
|
152 | |||
153 | next line |
|
153 | next line | |
154 | --- |
|
154 | --- | |
|
155 | % import patch1 patch2; rollback | |||
|
156 | parent: 0 | |||
|
157 | applying ../patch1 | |||
|
158 | applying ../patch2 | |||
|
159 | rolling back last transaction | |||
|
160 | parent: 1 | |||
155 | % hg import in a subdirectory |
|
161 | % hg import in a subdirectory | |
156 | requesting all changes |
|
162 | requesting all changes | |
157 | adding changesets |
|
163 | adding changesets |
@@ -42,6 +42,12 b' echo % qinit -c' | |||||
42 | hg --cwd c qinit -c |
|
42 | hg --cwd c qinit -c | |
43 | hg -R c/.hg/patches st |
|
43 | hg -R c/.hg/patches st | |
44 |
|
44 | |||
|
45 | echo % qnew should refuse bad patch names | |||
|
46 | hg -R c qnew series | |||
|
47 | hg -R c qnew status | |||
|
48 | hg -R c qnew guards | |||
|
49 | hg -R c qnew .hgignore | |||
|
50 | ||||
45 | echo % qnew implies add |
|
51 | echo % qnew implies add | |
46 |
|
52 | |||
47 | hg -R c qnew test.patch |
|
53 | hg -R c qnew test.patch | |
@@ -297,6 +303,13 b' hg st' | |||||
297 | echo % mq tags |
|
303 | echo % mq tags | |
298 | hg log --template '{rev} {tags}\n' -r qparent:qtip |
|
304 | hg log --template '{rev} {tags}\n' -r qparent:qtip | |
299 |
|
305 | |||
|
306 | echo % bad node in status | |||
|
307 | hg qpop | |||
|
308 | hg strip -qn tip | |||
|
309 | hg tip 2>&1 | sed -e 's/unknown node .*/unknown node/' | |||
|
310 | hg branches 2>&1 | sed -e 's/unknown node .*/unknown node/' | |||
|
311 | hg qpop | |||
|
312 | ||||
300 | cat >>$HGRCPATH <<EOF |
|
313 | cat >>$HGRCPATH <<EOF | |
301 | [diff] |
|
314 | [diff] | |
302 | git = True |
|
315 | git = True |
@@ -59,6 +59,11 b' adding b/z' | |||||
59 | % qinit -c |
|
59 | % qinit -c | |
60 | A .hgignore |
|
60 | A .hgignore | |
61 | A series |
|
61 | A series | |
|
62 | % qnew should refuse bad patch names | |||
|
63 | abort: "series" cannot be used as the name of a patch | |||
|
64 | abort: "status" cannot be used as the name of a patch | |||
|
65 | abort: "guards" cannot be used as the name of a patch | |||
|
66 | abort: ".hgignore" cannot be used as the name of a patch | |||
62 | % qnew implies add |
|
67 | % qnew implies add | |
63 | A .hgignore |
|
68 | A .hgignore | |
64 | A series |
|
69 | A series | |
@@ -281,6 +286,18 b' Errors during apply, please fix and refr' | |||||
281 | 0 qparent |
|
286 | 0 qparent | |
282 | 1 qbase foo |
|
287 | 1 qbase foo | |
283 | 2 qtip bar tip |
|
288 | 2 qtip bar tip | |
|
289 | % bad node in status | |||
|
290 | Now at: foo | |||
|
291 | changeset: 0:cb9a9f314b8b | |||
|
292 | mq status file refers to unknown node | |||
|
293 | tag: tip | |||
|
294 | user: test | |||
|
295 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
296 | summary: a | |||
|
297 | ||||
|
298 | mq status file refers to unknown node | |||
|
299 | default 0:cb9a9f314b8b | |||
|
300 | abort: working directory revision is not qtip | |||
284 | new file |
|
301 | new file | |
285 |
|
302 | |||
286 | diff --git a/new b/new |
|
303 | diff --git a/new b/new |
@@ -41,6 +41,15 b' echo corrupted > .hg/branch.cache' | |||||
41 | hg log -qr foo |
|
41 | hg log -qr foo | |
42 | cat .hg/branch.cache |
|
42 | cat .hg/branch.cache | |
43 |
|
43 | |||
|
44 | echo % push should update the branch cache | |||
|
45 | hg init ../target | |||
|
46 | echo % pushing just rev 0 | |||
|
47 | hg push -qr 0 ../target | |||
|
48 | cat ../target/.hg/branch.cache | |||
|
49 | echo % pushing everything | |||
|
50 | hg push -qf ../target | |||
|
51 | cat ../target/.hg/branch.cache | |||
|
52 | ||||
44 | echo % update with no arguments: tipmost revision of the current branch |
|
53 | echo % update with no arguments: tipmost revision of the current branch | |
45 | hg up -q -C 0 |
|
54 | hg up -q -C 0 | |
46 | hg up -q |
|
55 | hg up -q |
@@ -83,6 +83,15 b' 4909a3732169c0c20011c4f4b8fdff4e3d89b23f' | |||||
83 | bf1bc2f45e834c75404d0ddab57d53beab56e2f8 default |
|
83 | bf1bc2f45e834c75404d0ddab57d53beab56e2f8 default | |
84 | 4909a3732169c0c20011c4f4b8fdff4e3d89b23f foo |
|
84 | 4909a3732169c0c20011c4f4b8fdff4e3d89b23f foo | |
85 | 67ec16bde7f1575d523313b9bca000f6a6f12dca bar |
|
85 | 67ec16bde7f1575d523313b9bca000f6a6f12dca bar | |
|
86 | % push should update the branch cache | |||
|
87 | % pushing just rev 0 | |||
|
88 | be8523e69bf892e25817fc97187516b3c0804ae4 0 | |||
|
89 | be8523e69bf892e25817fc97187516b3c0804ae4 default | |||
|
90 | % pushing everything | |||
|
91 | 4909a3732169c0c20011c4f4b8fdff4e3d89b23f 4 | |||
|
92 | bf1bc2f45e834c75404d0ddab57d53beab56e2f8 default | |||
|
93 | 4909a3732169c0c20011c4f4b8fdff4e3d89b23f foo | |||
|
94 | 67ec16bde7f1575d523313b9bca000f6a6f12dca bar | |||
86 | % update with no arguments: tipmost revision of the current branch |
|
95 | % update with no arguments: tipmost revision of the current branch | |
87 | bf1bc2f45e83 |
|
96 | bf1bc2f45e83 | |
88 | 4909a3732169 (foo) tip |
|
97 | 4909a3732169 (foo) tip |
@@ -27,6 +27,11 b' r = os.system(sys.argv[2])' | |||||
27 | sys.exit(bool(r)) |
|
27 | sys.exit(bool(r)) | |
28 | EOF |
|
28 | EOF | |
29 |
|
29 | |||
|
30 | cat <<EOF > badhook | |||
|
31 | import sys | |||
|
32 | sys.stdout.write("KABOOM") | |||
|
33 | EOF | |||
|
34 | ||||
30 | echo "# creating 'remote'" |
|
35 | echo "# creating 'remote'" | |
31 | hg init remote |
|
36 | hg init remote | |
32 | cd remote |
|
37 | cd remote | |
@@ -91,13 +96,16 b' hg cat -r tip foo' | |||||
91 |
|
96 | |||
92 | echo z > z |
|
97 | echo z > z | |
93 | hg ci -A -m z -d '1000001 0' z |
|
98 | hg ci -A -m z -d '1000001 0' z | |
|
99 | # a bad, evil hook that prints to stdout | |||
|
100 | echo 'changegroup.stdout = python ../badhook' >> .hg/hgrc | |||
94 |
|
101 | |||
95 | cd ../local |
|
102 | cd ../local | |
96 | echo r > r |
|
103 | echo r > r | |
97 | hg ci -A -m z -d '1000002 0' r |
|
104 | hg ci -A -m z -d '1000002 0' r | |
98 |
|
105 | |||
99 | echo "# push should succeed" |
|
106 | echo "# push should succeed even though it has an unexpected response" | |
100 | hg push |
|
107 | hg push | |
|
108 | hg -R ../remote heads | |||
101 |
|
109 | |||
102 | cd .. |
|
110 | cd .. | |
103 | cat dummylog |
|
111 | cat dummylog |
@@ -70,7 +70,7 b' crosschecking files in changesets and ma' | |||||
70 | checking files |
|
70 | checking files | |
71 | 2 files, 2 changesets, 3 total revisions |
|
71 | 2 files, 2 changesets, 3 total revisions | |
72 | bleah |
|
72 | bleah | |
73 | # push should succeed |
|
73 | # push should succeed even though it has an unexpected response | |
74 | pushing to ssh://user@dummy/remote |
|
74 | pushing to ssh://user@dummy/remote | |
75 | searching for changes |
|
75 | searching for changes | |
76 | note: unsynced remote changes! |
|
76 | note: unsynced remote changes! | |
@@ -78,6 +78,21 b' remote: adding changesets' | |||||
78 | remote: adding manifests |
|
78 | remote: adding manifests | |
79 | remote: adding file changes |
|
79 | remote: adding file changes | |
80 | remote: added 1 changesets with 1 changes to 1 files |
|
80 | remote: added 1 changesets with 1 changes to 1 files | |
|
81 | abort: unexpected response: | |||
|
82 | 'KABOOM1\n' | |||
|
83 | changeset: 3:ac7448082955 | |||
|
84 | tag: tip | |||
|
85 | parent: 1:572896fe480d | |||
|
86 | user: test | |||
|
87 | date: Mon Jan 12 13:46:42 1970 +0000 | |||
|
88 | summary: z | |||
|
89 | ||||
|
90 | changeset: 2:187c6caa0d1e | |||
|
91 | parent: 0:e34318c26897 | |||
|
92 | user: test | |||
|
93 | date: Mon Jan 12 13:46:41 1970 +0000 | |||
|
94 | summary: z | |||
|
95 | ||||
81 | Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio |
|
96 | Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio | |
82 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
97 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio | |
83 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
98 | 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