Mercurial > hg
view tests/test-revlog-v2.t @ 42618:c17e6a3e7356
phabricator: handle local:commits time being string or int
When setting local:commits arcanist has different behaviour depending on
whether the repo is git or hg. With hg it sets the time as a number, since it
calls PHP's strtotime on the value, but with git it sets it as a string.
Normally this wouldn't be an issue since phabread wouldn't be interacting with
Phabricator Revisions for git repos, but Mozilla has a secondary workflow for
git users that uses the git-cinnabar tool to interact with their hg repos. When
a git-cinnabar user uses the moz-phab tool to submit patches for mozilla-central
it makes use of Mozilla's fork of arcanist, which works with their local git
version of m-c, and thus sets the local:commit time as a string, and then
translates the commit hashes.
Currently when encountering such DREVS phabread dies with "TypeError: %d format:
a number is required, not str".
phabsend also used to set it as a string but wouldn't have encountered the
issue with its own DREVs since it would read hg:meta first.
Differential Revision: https://phab.mercurial-scm.org/D6650
author | Ian Moody <moz-ian@perix.co.uk> |
---|---|
date | Tue, 16 Jul 2019 19:18:16 +0100 |
parents | e7a2cc84dbc0 |
children | 15d35f2ba474 |
line wrap: on
line source
#require reporevlogstore A repo with unknown revlogv2 requirement string cannot be opened $ hg init invalidreq $ cd invalidreq $ echo exp-revlogv2.unknown >> .hg/requires $ hg log abort: repository requires features unknown to this Mercurial: exp-revlogv2.unknown! (see https://mercurial-scm.org/wiki/MissingRequirement for more information) [255] $ cd .. Can create and open repo with revlog v2 requirement $ cat >> $HGRCPATH << EOF > [experimental] > revlogv2 = enable-unstable-format-and-corrupt-my-data > EOF $ hg init empty-repo $ cd empty-repo $ cat .hg/requires dotencode exp-revlogv2.1 fncache sparserevlog store $ hg log Unknown flags to revlog are rejected >>> with open('.hg/store/00changelog.i', 'wb') as fh: ... fh.write(b'\x00\x04\xde\xad') and None $ hg log abort: unknown flags (0x04) in version 57005 revlog 00changelog.i! [255] $ cd .. Writing a simple revlog v2 works $ hg init simple $ cd simple $ touch foo $ hg -q commit -A -m initial $ hg log changeset: 0:96ee1d7354c4 tag: tip user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: initial Header written as expected $ f --hexdump --bytes 4 .hg/store/00changelog.i .hg/store/00changelog.i: 0000: 00 01 de ad |....| $ f --hexdump --bytes 4 .hg/store/data/foo.i .hg/store/data/foo.i: 0000: 00 01 de ad |....|