diff --git a/hgext/largefiles/proto.py b/hgext/largefiles/proto.py --- a/hgext/largefiles/proto.py +++ b/hgext/largefiles/proto.py @@ -20,8 +20,10 @@ def putlfile(repo, proto, sha): user cache.''' proto.redirect() - tmpfp = util.atomictempfile(lfutil.storepath(repo, sha), - createmode=repo.store.createmode) + path = lfutil.storepath(repo, sha) + util.makedirs(os.path.dirname(path)) + tmpfp = util.atomictempfile(path, createmode=repo.store.createmode) + try: try: proto.getfile(tmpfp) diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -647,6 +647,7 @@ def bisect(ui, repo, rev=None, extra=Non try: while changesets: # update state + hbisect.save_state(repo, state) status = util.system(command, out=ui.fout) if status == 125: transition = "skip" diff --git a/mercurial/parsers.c b/mercurial/parsers.c --- a/mercurial/parsers.c +++ b/mercurial/parsers.c @@ -983,6 +983,7 @@ static int index_init(indexObject *self, self->ntdepth = self->ntsplits = 0; self->ntlookups = self->ntmisses = 0; self->ntrev = -1; + Py_INCREF(self->data); if (self->inlined) { long len = inline_scan(self, NULL); @@ -998,7 +999,6 @@ static int index_init(indexObject *self, self->raw_length = size / 64; self->length = self->raw_length + 1; } - Py_INCREF(self->data); return 0; bail: diff --git a/mercurial/pure/base85.py b/mercurial/pure/base85.py --- a/mercurial/pure/base85.py +++ b/mercurial/pure/base85.py @@ -54,9 +54,10 @@ def b85decode(text): try: acc = acc * 85 + _b85dec[c] except KeyError: - raise TypeError('Bad base85 character at byte %d' % (i + j)) + raise ValueError('bad base85 character at position %d' + % (i + j)) if acc > 4294967295: - raise OverflowError('Base85 overflow in hunk starting at byte %d' % i) + raise ValueError('Base85 overflow in hunk starting at byte %d' % i) out.append(acc) # Pad final chunk if necessary diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -43,8 +43,16 @@ def state(ctx, ui): rev = {} if '.hgsubstate' in ctx: try: - for l in ctx['.hgsubstate'].data().splitlines(): - revision, path = l.split(" ", 1) + for i, l in enumerate(ctx['.hgsubstate'].data().splitlines()): + l = l.lstrip() + if not l: + continue + try: + revision, path = l.split(" ", 1) + except ValueError: + raise util.Abort(_("invalid subrepository revision " + "specifier in .hgsubstate line %d") + % (i + 1)) rev[path] = revision except IOError, err: if err.errno != errno.ENOENT: diff --git a/tests/test-check-code-hg.t b/tests/test-check-code-hg.t --- a/tests/test-check-code-hg.t +++ b/tests/test-check-code-hg.t @@ -496,9 +496,6 @@ mercurial/patch.py:0: > except: warning: naked except clause - mercurial/pure/base85.py:0: - > raise OverflowError('Base85 overflow in hunk starting at byte %d' % i) - warning: line over 80 characters mercurial/pure/mpatch.py:0: > frags.extend(reversed(new)) # what was left at the end warning: line over 80 characters diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t --- a/tests/test-largefiles.t +++ b/tests/test-largefiles.t @@ -952,6 +952,31 @@ Corrupt the cached largefile in r7 [255] $ rm -rf empty +Push a largefiles repository to a served empty repository + $ hg init r8 + $ echo c3 > r8/f1 + $ hg add --large r8/f1 -R r8 + $ hg commit -m "m1" -R r8 + Invoking status precommit hook + A f1 + $ hg init empty + $ hg serve -R empty -d -p $HGPORT2 --pid-file hg.pid \ + > --config 'web.allow_push=*' --config web.push_ssl=False + $ cat hg.pid >> $DAEMON_PIDS + $ rm ${USERCACHE}/* + $ hg push -R r8 http://localhost:$HGPORT2 + pushing to http://localhost:$HGPORT2/ + searching for changes + searching for changes + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 1 changesets with 1 changes to 1 files + $ rm -rf empty + +used all HGPORTs, kill all daemons + $ "$TESTDIR/killdaemons.py" + Clone a local repository owned by another user We have to simulate that here by setting $HOME and removing write permissions $ ORIGHOME="$HOME" diff --git a/tests/test-subrepo-missing.t b/tests/test-subrepo-missing.t --- a/tests/test-subrepo-missing.t +++ b/tests/test-subrepo-missing.t @@ -12,6 +12,22 @@ adding b $ hg ci -m updatedsub +ignore blanklines in .hgsubstate + + >>> file('.hgsubstate', 'wb').write('\n\n \t \n \n') + $ hg st --subrepos + M .hgsubstate + $ hg revert -qC .hgsubstate + +abort more gracefully on .hgsubstate parsing error + + $ cp .hgsubstate .hgsubstate.old + >>> file('.hgsubstate', 'wb').write('\ninvalid') + $ hg st --subrepos + abort: invalid subrepository revision specifier in .hgsubstate line 2 + [255] + $ mv .hgsubstate.old .hgsubstate + delete .hgsub and revert it $ rm .hgsub