# HG changeset patch # User Alexis S. L. Carvalho # Date 2008-02-03 23:47:07 # Node ID 30d2fecaab7634c0185fd951bf72d7ad7eb6401d # Parent 8e7d64989bb8ecc9609e1272a411397f523e66a9 # Parent ee317dbfb9d0b1247ab6f882e530a8d8dc320413 merge with crew-stable diff --git a/hgext/convert/common.py b/hgext/convert/common.py --- a/hgext/convert/common.py +++ b/hgext/convert/common.py @@ -30,8 +30,8 @@ SKIPREV = 'SKIP' class commit(object): def __init__(self, author, date, desc, parents, branch=None, rev=None, extra={}): - self.author = author - self.date = date + self.author = author or 'unknown' + self.date = date or '0 0' self.desc = desc self.parents = parents self.branch = branch diff --git a/hgext/convert/git.py b/hgext/convert/git.py --- a/hgext/convert/git.py +++ b/hgext/convert/git.py @@ -102,7 +102,6 @@ class convert_git(converter_source): tzs, tzh, tzm = tz[-5:-4] + "1", tz[-4:-2], tz[-2:] tz = -int(tzs) * (int(tzh) * 3600 + int(tzm)) date = tm + " " + str(tz) - author = author or "unknown" c = commit(parents=parents, date=date, author=author, desc=message, rev=version) diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -600,11 +600,19 @@ class queue: raise util.Abort(_("local changes found")) return m, a, r, d + _reserved = ('series', 'status', 'guards') + def check_reserved_name(self, name): + if (name in self._reserved or name.startswith('.hg') + or name.startswith('.mq')): + raise util.Abort(_('"%s" cannot be used as the name of a patch') + % name) + def new(self, repo, patch, *pats, **opts): msg = opts.get('msg') force = opts.get('force') user = opts.get('user') date = opts.get('date') + self.check_reserved_name(patch) if os.path.exists(self.join(patch)): raise util.Abort(_('patch "%s" already exists') % patch) if opts.get('include') or opts.get('exclude') or pats: @@ -872,10 +880,16 @@ class queue: start = info[0] rev = revlog.bin(info[1]) + if update: + top = self.check_toppatch(repo) + + if repo.changelog.heads(rev) != [revlog.bin(self.applied[-1].rev)]: + raise util.Abort("popping would remove a revision not " + "managed by this patch queue") + # we know there are no local changes, so we can make a simplified # form of hg.update. if update: - top = self.check_toppatch(repo) qp = self.qparents(repo, rev) changes = repo.changelog.read(qp) mmap = repo.manifest.read(changes[0]) @@ -898,8 +912,8 @@ class queue: except: pass repo.dirstate.forget(f) repo.dirstate.setparents(qp, revlog.nullid) + del self.applied[start:end] self.strip(repo, rev, update=False, backup='strip') - del self.applied[start:end] if len(self.applied): self.ui.write("Now at: %s\n" % self.applied[-1].name) else: @@ -926,6 +940,8 @@ class queue: self.check_toppatch(repo) (top, patchfn) = (self.applied[-1].rev, self.applied[-1].name) top = revlog.bin(top) + if repo.changelog.heads(top) != [top]: + raise util.Abort("cannot refresh a revision with children") cparents = repo.changelog.parents(top) patchparent = self.qparents(repo, top) message, comments, user, date, patchfound = self.readheaders(patchfn) @@ -1112,12 +1128,13 @@ class queue: if not user: user = changes[1] + self.applied.pop() + self.applied_dirty = 1 self.strip(repo, top, update=False, backup='strip') n = repo.commit(filelist, message, user, date, match=matchfn, force=1) - self.applied[-1] = statusentry(revlog.hex(n), patchfn) - self.applied_dirty = 1 + self.applied.append(statusentry(revlog.hex(n), patchfn)) self.removeundo(repo) else: self.printdiff(repo, patchparent, fp=patchf) @@ -1406,6 +1423,7 @@ class queue: if not patchname: patchname = normname('%d.diff' % r) + self.check_reserved_name(patchname) checkseries(patchname) checkfile(patchname) self.full_series.insert(0, patchname) @@ -1428,6 +1446,7 @@ class queue: raise util.Abort(_('-e is incompatible with import from -')) if not patchname: patchname = normname(filename) + self.check_reserved_name(patchname) if not os.path.isfile(self.join(patchname)): raise util.Abort(_("patch %s does not exist") % patchname) else: @@ -1442,6 +1461,7 @@ class queue: raise util.Abort(_("unable to read %s") % patchname) if not patchname: patchname = normname(os.path.basename(filename)) + self.check_reserved_name(patchname) checkfile(patchname) patchf = self.opener(patchname, "w") patchf.write(text) @@ -2147,6 +2167,12 @@ def reposetup(ui, repo): return tagscache mqtags = [(revlog.bin(patch.rev), patch.name) for patch in q.applied] + + if mqtags[-1][0] not in self.changelog.nodemap: + self.ui.warn('mq status file refers to unknown node %s\n' + % revlog.short(mqtags[-1][0])) + return tagscache + mqtags.append((mqtags[-1][0], 'qtip')) mqtags.append((mqtags[0][0], 'qbase')) mqtags.append((self.changelog.parents(mqtags[0][0])[0], 'qparent')) @@ -2163,11 +2189,17 @@ def reposetup(ui, repo): if not q.applied: return super(mqrepo, self)._branchtags() + cl = self.changelog + qbasenode = revlog.bin(q.applied[0].rev) + if qbasenode not in cl.nodemap: + self.ui.warn('mq status file refers to unknown node %s\n' + % revlog.short(qbasenode)) + return super(mqrepo, self)._branchtags() + self.branchcache = {} # avoid recursion in changectx - cl = self.changelog partial, last, lrev = self._readbranchcache() - qbase = cl.rev(revlog.bin(q.applied[0].rev)) + qbase = cl.rev(qbasenode) start = lrev + 1 if start < qbase: # update the cache (excluding the patches) and save it diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1540,6 +1540,9 @@ def import_(ui, repo, patch1, *patches, repo.rollback() raise util.Abort(_('patch is damaged' ' or loses information')) + # Force a dirstate write so that the next transaction + # backups an up-do-date file. + repo.dirstate.write() finally: os.unlink(tmpname) finally: diff --git a/mercurial/httprepo.py b/mercurial/httprepo.py --- a/mercurial/httprepo.py +++ b/mercurial/httprepo.py @@ -103,10 +103,13 @@ class httpconnection(keepalive.HTTPConne # must be able to send big bundle as stream. send = _gen_sendfile(keepalive.HTTPConnection) -class basehttphandler(keepalive.HTTPHandler): +class httphandler(keepalive.HTTPHandler): def http_open(self, req): return self.do_open(httpconnection, req) + def __del__(self): + self.close_all() + has_https = hasattr(urllib2, 'HTTPSHandler') if has_https: class httpsconnection(httplib.HTTPSConnection): @@ -114,12 +117,9 @@ if has_https: # must be able to send big bundle as stream. send = _gen_sendfile(httplib.HTTPSConnection) - class httphandler(basehttphandler, urllib2.HTTPSHandler): + class httpshandler(keepalive.KeepAliveHandler, urllib2.HTTPSHandler): def https_open(self, req): return self.do_open(httpsconnection, req) -else: - class httphandler(basehttphandler): - pass # In python < 2.5 AbstractDigestAuthHandler raises a ValueError if # it doesn't know about the auth type requested. This can happen if @@ -203,8 +203,9 @@ class httprepository(remoterepository): proxyurl = ui.config("http_proxy", "host") or os.getenv('http_proxy') # XXX proxyauthinfo = None - self.handler = httphandler() - handlers = [self.handler] + handlers = [httphandler()] + if has_https: + handlers.append(httpshandler()) if proxyurl: # proxy can be proper url or host[:port] @@ -270,11 +271,6 @@ class httprepository(remoterepository): opener.addheaders = [('User-agent', 'mercurial/proto-1.0')] urllib2.install_opener(opener) - def __del__(self): - if self.handler: - self.handler.close_all() - self.handler = None - def url(self): return self.path diff --git a/mercurial/keepalive.py b/mercurial/keepalive.py --- a/mercurial/keepalive.py +++ b/mercurial/keepalive.py @@ -175,7 +175,7 @@ class ConnectionManager: else: return dict(self._hostmap) -class HTTPHandler(urllib2.HTTPHandler): +class KeepAliveHandler: def __init__(self): self._cm = ConnectionManager() @@ -314,6 +314,9 @@ class HTTPHandler(urllib2.HTTPHandler): except socket.error, err: # XXX what error? raise urllib2.URLError(err) +class HTTPHandler(KeepAliveHandler, urllib2.HTTPHandler): + pass + class HTTPResponse(httplib.HTTPResponse): # we need to subclass HTTPResponse in order to # 1) add readline() and readlines() methods diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -120,6 +120,7 @@ class localrepository(repo.repository): self.hook('pretag', throw=True, node=hex(node), tag=name, local=local) def writetag(fp, name, munge, prevtags): + fp.seek(0, 2) if prevtags and prevtags[-1] != '\n': fp.write('\n') fp.write('%s %s\n' % (hex(node), munge and munge(name) or name)) @@ -1981,6 +1982,10 @@ class localrepository(repo.repository): del tr if changesets > 0: + # forcefully update the on-disk branch cache + self.ui.debug(_("updating the branch cache\n")) + self.branchcache = None + self.branchtags() self.hook("changegroup", node=hex(self.changelog.node(cor+1)), source=srctype, url=url) diff --git a/mercurial/sshrepo.py b/mercurial/sshrepo.py --- a/mercurial/sshrepo.py +++ b/mercurial/sshrepo.py @@ -114,14 +114,25 @@ class sshrepository(remoterepository): return self.pipei def call(self, cmd, **args): - r = self.do_cmd(cmd, **args) - l = r.readline() + self.do_cmd(cmd, **args) + return self._recv() + + def _recv(self): + l = self.pipei.readline() self.readerr() try: l = int(l) except: self.raise_(util.UnexpectedOutput(_("unexpected response:"), l)) - return r.read(l) + return self.pipei.read(l) + + def _send(self, data, flush=False): + self.pipeo.write("%d\n" % len(data)) + if data: + self.pipeo.write(data) + if flush: + self.pipeo.flush() + self.readerr() def lock(self): self.call("lock") @@ -182,25 +193,22 @@ class sshrepository(remoterepository): while 1: d = cg.read(4096) - if not d: break - self.pipeo.write(str(len(d)) + '\n') - self.pipeo.write(d) - self.readerr() + if not d: + break + self._send(d) - self.pipeo.write('0\n') - self.pipeo.flush() + self._send("", flush=True) - self.readerr() - l = int(self.pipei.readline()) - r = self.pipei.read(l) + r = self._recv() if r: # remote may send "unsynced changes" self.raise_(repo.RepoError(_("push failed: %s") % r)) - self.readerr() - l = int(self.pipei.readline()) - r = self.pipei.read(l) - return int(r) + r = self._recv() + try: + return int(r) + except: + self.raise_(util.UnexpectedOutput(_("unexpected response:"), r)) def addchangegroup(self, cg, source, url): d = self.call("addchangegroup") @@ -208,18 +216,21 @@ class sshrepository(remoterepository): self.raise_(repo.RepoError(_("push refused: %s") % d)) while 1: d = cg.read(4096) - if not d: break + if not d: + break self.pipeo.write(d) self.readerr() self.pipeo.flush() self.readerr() - l = int(self.pipei.readline()) - r = self.pipei.read(l) + r = self._recv() if not r: return 1 - return int(r) + try: + return int(r) + except: + self.raise_(util.UnexpectedOutput(_("unexpected response:"), r)) def stream_out(self): return self.do_cmd('stream_out') diff --git a/templates/header.tmpl b/templates/header.tmpl --- a/templates/header.tmpl +++ b/templates/header.tmpl @@ -1,6 +1,6 @@ - + diff --git a/templates/old/header.tmpl b/templates/old/header.tmpl --- a/templates/old/header.tmpl +++ b/templates/old/header.tmpl @@ -1,6 +1,6 @@ - + diff --git a/tests/test-acl.out b/tests/test-acl.out --- a/tests/test-acl.out +++ b/tests/test-acl.out @@ -28,6 +28,7 @@ adding foo/Bar/file.txt revisions adding foo/file.txt revisions adding quux/file.py revisions added 3 changesets with 3 changes to 3 files +updating the branch cache rolling back last transaction 0:6675d58eff77 @@ -59,6 +60,7 @@ calling hook pretxnchangegroup.acl: hgex acl: acl.allow not enabled acl: acl.deny not enabled acl: changes have source "push" - skipping +updating the branch cache rolling back last transaction 0:6675d58eff77 @@ -94,6 +96,7 @@ acl: acl.deny not enabled acl: allowing changeset ef1ea85a6374 acl: allowing changeset f9cafe1212c8 acl: allowing changeset 911600dab2ae +updating the branch cache rolling back last transaction 0:6675d58eff77 @@ -383,6 +386,7 @@ acl: acl.deny enabled, 0 entries for use acl: allowing changeset ef1ea85a6374 acl: allowing changeset f9cafe1212c8 acl: allowing changeset 911600dab2ae +updating the branch cache rolling back last transaction 0:6675d58eff77 @@ -578,6 +582,7 @@ acl: acl.deny enabled, 0 entries for use acl: allowing changeset ef1ea85a6374 acl: allowing changeset f9cafe1212c8 acl: allowing changeset 911600dab2ae +updating the branch cache rolling back last transaction 0:6675d58eff77 diff --git a/tests/test-hgweb-commands.out b/tests/test-hgweb-commands.out index 326d8df07cad7af2196b263febeb5b826bf1fdc8..684b3e91d0dd961c12354408a2906d90d327a5b0 GIT binary patch literal 15009 zc%1E9>2ljR63+fy)jkASrR<`W=|vom8ZL^`%CXK>uN;h$px|3mA0kt~d9k4(NWO>!!8@!uUO`DLOMU76k^Ga~8A+p}^k+j)qkqL?gj?OamSgIAem#Ggt{HZfKwoTiC_mypr<@<^JoLHKq2jnak{1(P(zTf*kC`iy50TqIJ zxmG@yZNLJXddI^Nb%v$HcBL#B_m(`Qk@dJ>VA5eQ8ZduwFgh8y%sxDFM<<5^pB?%E zJ2^gJ6u1Yr&vK3C+S#BD&aSO(8A{EO30;bL!ts(!V!BXToLKTwHnIf`qv@BA9p~s2 zK5Yj-ox@YrGO<)Yva(8EJE%noCeWD7(qRphfn@3XW&tvQx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OU{$UB8kbjRu6yJ_A6OXJ_~`!MlFInK@i>~?cm^` zwv?e-iso+JpTOqr7roU0TEfwK6qvWrY?~)#N&dHNkKS z9~Iis+1kQ~;rL@DEXzVVL51~;U#b+l&9Q-%+=jYK$B(@Ku+c5%+SBy}TZw$P87+$Qx@x%Jh9j;ckJOkBqmtt|l`A6(?OzY+varbJ{o2TTr?ty1g( zxoxTg`}y_lZY)aYLmVQX1;{BCxKs1|eXVV?OSMOgGCKr8(CT+>GWs&B?vs|DN;M8< zvcW32K-^Qr4}*Z<(>=L9dhs&czOQn?aQl+Hy6)({{_e& BD%$`6 diff --git a/tests/test-hgweb.out b/tests/test-hgweb.out --- a/tests/test-hgweb.out +++ b/tests/test-hgweb.out @@ -24,7 +24,7 @@ 404 Not Found - + diff --git a/tests/test-import b/tests/test-import --- a/tests/test-import +++ b/tests/test-import @@ -125,6 +125,18 @@ python mkmsg2.py | hg --cwd b import - hg --cwd b tip --template '{desc}\n' rm -r b +# We weren't backing up the correct dirstate file when importing many patches +# (issue963) +echo '% import patch1 patch2; rollback' +echo line 3 >> a/a +hg --cwd a ci -m'third change' +hg --cwd a export -o '../patch%R' 1 2 +hg clone -qr0 a b +hg --cwd b parents --template 'parent: #rev#\n' +hg --cwd b import ../patch1 ../patch2 +hg --cwd b rollback +hg --cwd b parents --template 'parent: #rev#\n' +rm -r b # bug non regression test # importing a patch in a subdirectory failed at the commit stage diff --git a/tests/test-import.out b/tests/test-import.out --- a/tests/test-import.out +++ b/tests/test-import.out @@ -152,6 +152,12 @@ email patch next line --- +% import patch1 patch2; rollback +parent: 0 +applying ../patch1 +applying ../patch2 +rolling back last transaction +parent: 1 % hg import in a subdirectory requesting all changes adding changesets diff --git a/tests/test-mq b/tests/test-mq --- a/tests/test-mq +++ b/tests/test-mq @@ -42,6 +42,12 @@ echo % qinit -c hg --cwd c qinit -c hg -R c/.hg/patches st +echo % qnew should refuse bad patch names +hg -R c qnew series +hg -R c qnew status +hg -R c qnew guards +hg -R c qnew .hgignore + echo % qnew implies add hg -R c qnew test.patch @@ -297,6 +303,13 @@ hg st echo % mq tags hg log --template '{rev} {tags}\n' -r qparent:qtip +echo % bad node in status +hg qpop +hg strip -qn tip +hg tip 2>&1 | sed -e 's/unknown node .*/unknown node/' +hg branches 2>&1 | sed -e 's/unknown node .*/unknown node/' +hg qpop + cat >>$HGRCPATH <> $HGRCPATH +echo 'hgext.mq =' >> $HGRCPATH + +hg init repo +cd repo + +echo foo > foo +hg ci -qAm 'add a file' + +hg qinit + +hg qnew foo +echo foo >> foo +hg qrefresh -m 'append foo' + +hg qnew bar +echo bar >> foo +hg qrefresh -m 'append bar' + +echo '% try to commit on top of a patch' +echo quux >> foo +hg ci -m 'append quux' + +# cheat a bit... +mv .hg/patches .hg/patches2 +hg ci -m 'append quux' +mv .hg/patches2 .hg/patches + +echo '% qpop/qrefresh on the wrong revision' +hg qpop +hg qpop -n patches 2>&1 | sed -e 's/\(using patch queue:\).*/\1/' +hg qrefresh + +hg up -C qtip +echo '% qpop' +hg qpop + +echo '% qrefresh' +hg qrefresh + +echo '% tip:' +hg tip --template '#rev# #desc#\n' diff --git a/tests/test-mq-safety.out b/tests/test-mq-safety.out new file mode 100644 --- /dev/null +++ b/tests/test-mq-safety.out @@ -0,0 +1,14 @@ +% try to commit on top of a patch +abort: cannot commit over an applied mq patch +% qpop/qrefresh on the wrong revision +abort: working directory revision is not qtip +using patch queue: +abort: popping would remove a revision not managed by this patch queue +abort: working directory revision is not qtip +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +% qpop +abort: popping would remove a revision not managed by this patch queue +% qrefresh +abort: cannot refresh a revision with children +% tip: +3 append quux diff --git a/tests/test-mq.out b/tests/test-mq.out --- a/tests/test-mq.out +++ b/tests/test-mq.out @@ -59,6 +59,11 @@ adding b/z % qinit -c A .hgignore A series +% qnew should refuse bad patch names +abort: "series" cannot be used as the name of a patch +abort: "status" cannot be used as the name of a patch +abort: "guards" cannot be used as the name of a patch +abort: ".hgignore" cannot be used as the name of a patch % qnew implies add A .hgignore A series @@ -281,6 +286,18 @@ Errors during apply, please fix and refr 0 qparent 1 qbase foo 2 qtip bar tip +% bad node in status +Now at: foo +changeset: 0:cb9a9f314b8b +mq status file refers to unknown node +tag: tip +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: a + +mq status file refers to unknown node +default 0:cb9a9f314b8b +abort: working directory revision is not qtip new file diff --git a/new b/new diff --git a/tests/test-newbranch b/tests/test-newbranch --- a/tests/test-newbranch +++ b/tests/test-newbranch @@ -41,6 +41,15 @@ echo corrupted > .hg/branch.cache hg log -qr foo cat .hg/branch.cache +echo % push should update the branch cache +hg init ../target +echo % pushing just rev 0 +hg push -qr 0 ../target +cat ../target/.hg/branch.cache +echo % pushing everything +hg push -qf ../target +cat ../target/.hg/branch.cache + echo % update with no arguments: tipmost revision of the current branch hg up -q -C 0 hg up -q diff --git a/tests/test-newbranch.out b/tests/test-newbranch.out --- a/tests/test-newbranch.out +++ b/tests/test-newbranch.out @@ -83,6 +83,15 @@ 4909a3732169c0c20011c4f4b8fdff4e3d89b23f bf1bc2f45e834c75404d0ddab57d53beab56e2f8 default 4909a3732169c0c20011c4f4b8fdff4e3d89b23f foo 67ec16bde7f1575d523313b9bca000f6a6f12dca bar +% push should update the branch cache +% pushing just rev 0 +be8523e69bf892e25817fc97187516b3c0804ae4 0 +be8523e69bf892e25817fc97187516b3c0804ae4 default +% pushing everything +4909a3732169c0c20011c4f4b8fdff4e3d89b23f 4 +bf1bc2f45e834c75404d0ddab57d53beab56e2f8 default +4909a3732169c0c20011c4f4b8fdff4e3d89b23f foo +67ec16bde7f1575d523313b9bca000f6a6f12dca bar % update with no arguments: tipmost revision of the current branch bf1bc2f45e83 4909a3732169 (foo) tip diff --git a/tests/test-ssh b/tests/test-ssh --- a/tests/test-ssh +++ b/tests/test-ssh @@ -27,6 +27,11 @@ r = os.system(sys.argv[2]) sys.exit(bool(r)) EOF +cat < badhook +import sys +sys.stdout.write("KABOOM") +EOF + echo "# creating 'remote'" hg init remote cd remote @@ -91,13 +96,16 @@ hg cat -r tip foo echo z > z hg ci -A -m z -d '1000001 0' z +# a bad, evil hook that prints to stdout +echo 'changegroup.stdout = python ../badhook' >> .hg/hgrc cd ../local echo r > r hg ci -A -m z -d '1000002 0' r -echo "# push should succeed" +echo "# push should succeed even though it has an unexpected response" hg push +hg -R ../remote heads cd .. cat dummylog diff --git a/tests/test-ssh.out b/tests/test-ssh.out --- a/tests/test-ssh.out +++ b/tests/test-ssh.out @@ -70,7 +70,7 @@ crosschecking files in changesets and ma checking files 2 files, 2 changesets, 3 total revisions bleah -# push should succeed +# push should succeed even though it has an unexpected response pushing to ssh://user@dummy/remote searching for changes note: unsynced remote changes! @@ -78,6 +78,21 @@ remote: adding changesets remote: adding manifests remote: adding file changes remote: added 1 changesets with 1 changes to 1 files +abort: unexpected response: +'KABOOM1\n' +changeset: 3:ac7448082955 +tag: tip +parent: 1:572896fe480d +user: test +date: Mon Jan 12 13:46:42 1970 +0000 +summary: z + +changeset: 2:187c6caa0d1e +parent: 0:e34318c26897 +user: test +date: Mon Jan 12 13:46:41 1970 +0000 +summary: z + Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio Got arguments 1:user@dummy 2:hg -R remote serve --stdio Got arguments 1:user@dummy 2:hg -R remote serve --stdio