Submitter | Yuya Nishihara |
---|---|
Date | Jan. 21, 2019, 1:48 p.m. |
Message ID | <498a5d7f8e19d6b430f3.1548078532@mimosa> |
Download | mbox | patch |
Permalink | /patch/37890/ |
State | Accepted |
Headers | show |
Comments
queued, thanks > On Jan 21, 2019, at 08:48, Yuya Nishihara <yuya@tcha.org> wrote: > > # HG changeset patch > # User Yuya Nishihara <yuya@tcha.org> > # Date 1548076469 -32400 > # Mon Jan 21 22:14:29 2019 +0900 > # Branch stable > # Node ID 498a5d7f8e19d6b430f300ff6687a92270022f81 > # Parent 13c23396c7fe1633a2336b29e3a32b9b76274f28 > revlog: fix resolution of revlog version 0 > > This partially backs out cecf3f8bccd3, "revlog: always process opener options." > > My understanding is that if there's no "revlog1" nor "revlog2" in .hg/requires, > the repository should stick to the v0 format. The reasoning is briefly > described in 31a5973fcf96, "revlog: get rid of defversion." > > Maybe we can drop support for missing opener options, but I didn't do that > in this patch. > > diff --git a/mercurial/revlog.py b/mercurial/revlog.py > --- a/mercurial/revlog.py > +++ b/mercurial/revlog.py > @@ -396,6 +396,11 @@ class revlog(object): > newversionflags = REVLOGV1 | FLAG_INLINE_DATA > if 'generaldelta' in opts: > newversionflags |= FLAG_GENERALDELTA > + elif getattr(self.opener, 'options', None) is not None: > + # If options provided but no 'revlog*' found, the repository > + # would have no 'requires' file in it, which means we have to > + # stick to the old format. > + newversionflags = REVLOGV0 > else: > newversionflags = REVLOG_DEFAULT_VERSION > > diff --git a/tests/test-clone.t b/tests/test-clone.t > --- a/tests/test-clone.t > +++ b/tests/test-clone.t > @@ -717,6 +717,9 @@ Test clone from the repository in (emula > $ hg -R src commit -m '#0' > $ hg -R src log -q > 0:e1bab28bca43 > + $ hg -R src debugrevlog -c | egrep 'format|flags' > + format : 0 > + flags : (none) > $ hg clone -U -q src dst > $ hg -R dst log -q > 0:e1bab28bca43 > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Patch
diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -396,6 +396,11 @@ class revlog(object): newversionflags = REVLOGV1 | FLAG_INLINE_DATA if 'generaldelta' in opts: newversionflags |= FLAG_GENERALDELTA + elif getattr(self.opener, 'options', None) is not None: + # If options provided but no 'revlog*' found, the repository + # would have no 'requires' file in it, which means we have to + # stick to the old format. + newversionflags = REVLOGV0 else: newversionflags = REVLOG_DEFAULT_VERSION diff --git a/tests/test-clone.t b/tests/test-clone.t --- a/tests/test-clone.t +++ b/tests/test-clone.t @@ -717,6 +717,9 @@ Test clone from the repository in (emula $ hg -R src commit -m '#0' $ hg -R src log -q 0:e1bab28bca43 + $ hg -R src debugrevlog -c | egrep 'format|flags' + format : 0 + flags : (none) $ hg clone -U -q src dst $ hg -R dst log -q 0:e1bab28bca43