Re: [PATCH 5 of 5] color: add the ability to display configured style to 'debugcolor'
On Thu, 03 Nov 2016 16:56:36 +0100, Pierre-Yves David wrote: > # HG changeset patch > # User Pierre-Yves David> # Date 1478182622 -3600 > # Thu Nov 03 15:17:02 2016 +0100 > # Node ID cfef7fd6c10c67db982062c4761cdaf11eeaeec2 > # Parent ca827619fe6580c6e9220b0e98c6d9dfc51f6b4f > # EXP-Topic debugcolor > color: add the ability to display configured style to 'debugcolor' Nice. Queued the series, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 4] tests: simplify command script in 'test-push-r.t'
On Thu, 03 Nov 2016 09:35:18 +0100, Pierre-Yves David wrote: > # HG changeset patch > # User Pierre-Yves David> # Date 1478145934 -3600 > # Thu Nov 03 05:05:34 2016 +0100 > # Node ID 88c6789dedad1ca6bf4d4323b7332e76f233b531 > # Parent 6a8aff737a17ada068b8ce4501184eacc66e827f > # EXP-Topic pushtest > tests: simplify command script in 'test-push-r.t' Seems fine. Queued the series, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 2 of 7] py3: make sure osutil.listdir() returns what it gets
On Thu, 03 Nov 2016 03:53:07 +0530, Pulkit Goyal wrote: > # HG changeset patch > # User Pulkit Goyal <7895pul...@gmail.com> > # Date 1478118344 -19800 > # Thu Nov 03 01:55:44 2016 +0530 > # Node ID 6585e9c1d915818d5138f6cb4134707002d5d749 > # Parent e541b0e5839988f63446c88509db68772a55775b > py3: make sure osutil.listdir() returns what it gets > > osutil.listdir() on py3 was having problems with bytes. Since > os.sep is a str in Py3, we need to check if what passed is bytes and then > convert os.sep to bytes. On python 2, doing os.sep.encode() is okay. > After this patch, osutil.listdir() argument will return what is gets as an > argument on Python 3.5. > > diff -r e541b0e58399 -r 6585e9c1d915 mercurial/pure/osutil.py > --- a/mercurial/pure/osutil.pyThu Nov 03 00:28:33 2016 +0530 > +++ b/mercurial/pure/osutil.pyThu Nov 03 01:55:44 2016 +0530 > @@ -51,8 +51,11 @@ > ''' > result = [] > prefix = path > -if not prefix.endswith(os.sep): > -prefix += os.sep > +sep = os.sep > +if isinstance(path, bytes): > +sep = sep.encode('ascii') > +if not prefix.endswith(sep): > +prefix += sep Suppose path must be bytes because osutil.listdir() is a Mercurial API, we can always use bytes variant of os.sep everywhere, which could be provided by pycompat. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 7] py3: make util.datapath a bytes variable
On Thu, 03 Nov 2016 03:53:06 +0530, Pulkit Goyal wrote: > # HG changeset patch > # User Pulkit Goyal <7895pul...@gmail.com> > # Date 1478113113 -19800 > # Thu Nov 03 00:28:33 2016 +0530 > # Node ID e541b0e5839988f63446c88509db68772a55775b > # Parent bb586966818986131068280bfd95fc96fbdaaa0d > py3: make util.datapath a bytes variable > > Fixing things when a warning or error comes up was a good approach, but that > won't work in long time, because we will be having all the errors fixed > but no idea where we set which variable to bytes and which to unicodes. > Which function is returning bytes and which is returning unicodes. > We have to make sure if some variable is changed then its effects throughout > the repository are taken care. > > In this patch we make util.datapath a bytes variables. > > The line containing i18n.setdatapath is skipped for a reason. > i18n.setdatapath looks something like this. > > def setdatapath(datapath): > localedir = os.path.join(datapath, pycompat.sysstr('locale')) > t = gettextmod.translation('hg', localedir, _languages, fallback=True) > > > Here we can't pass gettextmod.translation() bytes when we have _languages as > None in Python 3.5. But yeah we can pass 'hg' as bytes because the code which > returns TypeError deals with localedir variable only. So we need localedir to > be unicode to make gettextmod.translation() happy. If we pass the bytes > version of datapath we will have to convert localedir back to unicode. > So skipped that line of code before converting util.datapath to bytes to > use in rest of the code. i18n.setdatapath() can decode bytes to unicode by fsdecode() for consistency of API. > diff -r bb5869668189 -r e541b0e58399 mercurial/util.py > --- a/mercurial/util.py Tue Nov 01 15:40:21 2016 -0400 > +++ b/mercurial/util.py Thu Nov 03 00:28:33 2016 +0530 > @@ -940,6 +940,9 @@ > > i18n.setdatapath(datapath) > > +if not isinstance(datapath, bytes): > +datapath = datapath.encode('utf-8') Perhaps we can use pycompat.fsencode(), which would be what Python 2 does on Windows. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 4 of 7] py3: make scmposix.userrcpath() return bytes
On Thu, 03 Nov 2016 03:53:09 +0530, Pulkit Goyal wrote: > # HG changeset patch > # User Pulkit Goyal <7895pul...@gmail.com> > # Date 1478119621 -19800 > # Thu Nov 03 02:17:01 2016 +0530 > # Node ID e0e794c3b580b1f64d37ccdd6d8bd606eb87880e > # Parent 9d54c24d17daddf2ede7fe7ce58751ab9a1780a4 > py3: make scmposix.userrcpath() return bytes LGTM, queued this, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 6 of 7] py3: use try/except to check for basestring
On Thu, 03 Nov 2016 03:53:11 +0530, Pulkit Goyal wrote: > # HG changeset patch > # User Pulkit Goyal <7895pul...@gmail.com> > # Date 1478121825 -19800 > # Thu Nov 03 02:53:45 2016 +0530 > # Node ID aef03902a5c1a13e9775059a5efdeb2466399ada > # Parent 9e259e7b59b6358eb842eabbc99f4c18a4cc5009 > py3: use try/except to check for basestring > > The term basestring don't exist in Python 3.5 and throws a NameError. > It used to refer to unicodes in Python 2. Used try/expect to handle this. > > diff -r 9e259e7b59b6 -r aef03902a5c1 mercurial/ui.py > --- a/mercurial/ui.py Thu Nov 03 02:27:46 2016 +0530 > +++ b/mercurial/ui.py Thu Nov 03 02:53:45 2016 +0530 > @@ -520,7 +520,12 @@ > result = self.config(section, name, untrusted=untrusted) > if result is None: > result = default or [] > -if isinstance(result, basestring): > +checkunicode = False > +try: > +checkunicode = isinstance(result, basestring) > +except NameError: > +checkunicode = isinstance(result, str) > +if checkunicode: > result = _configlist(result.lstrip(' ,\n')) Given "result" is a source variable of a list to be returned, it shouldn't be a unicode. So we can simply use bytes instead of basestring here. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 3 of 7] py3: make scmpoxis.systemrcpath() return bytes
On Thu, 03 Nov 2016 03:53:08 +0530, Pulkit Goyal wrote: > # HG changeset patch > # User Pulkit Goyal <7895pul...@gmail.com> > # Date 1478119178 -19800 > # Thu Nov 03 02:09:38 2016 +0530 > # Node ID 9d54c24d17daddf2ede7fe7ce58751ab9a1780a4 > # Parent 6585e9c1d915818d5138f6cb4134707002d5d749 > py3: make scmpoxis.systemrcpath() return bytes > > The variable `p` is a str on Python 3 which is not bytes. We should convert > it to bytes because > 1. root is bytes and we want the final output in bytes > 2. to make the if condition works fine because in py3 its p != b'/' > > So even if p is '/' but left as a str on py3, will make the condition false. > This patch ensures that scmposix.systemrcpath() return bytes and also > scmposix._rcfiles() returns and accepts bytes. The later is used in > scmposix.py only. > > diff -r 6585e9c1d915 -r 9d54c24d17da mercurial/scmposix.py > --- a/mercurial/scmposix.py Thu Nov 03 01:55:44 2016 +0530 > +++ b/mercurial/scmposix.py Thu Nov 03 02:09:38 2016 +0530 > @@ -27,6 +27,8 @@ > # old mod_python does not set sys.argv > if len(getattr(sys, 'argv', [])) > 0: > p = os.path.dirname(os.path.dirname(sys.argv[0])) > +if not isinstance(p, bytes): > +p = p.encode('utf-8') We can't assume external encoding is UTF-8. IIRC, Augie had some patches to work around the sys.argv issue. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[Bug 5411] New: hg log -f can miss changesets
https://bz.mercurial-scm.org/show_bug.cgi?id=5411 Bug ID: 5411 Summary: hg log -f can miss changesets Product: Mercurial Version: default branch Hardware: All OS: All Status: UNCONFIRMED Severity: bug Priority: wish Component: Mercurial Assignee: bugzi...@selenic.com Reporter: arcppzju+hg...@gmail.com CC: mercurial-de...@selenic.com In the mercurial repo, hg log -f -r 15efc1d06143 doc/Makefile Expected: 15efc1d06143 is printed because it modified doc/Makefile Actual: 15efc1d06143 is not printed. Note that "hg annotate -r 15efc1d06143 -c doc/Makefile" includes 15efc1d06143 in two lines correctly. -- You are receiving this mail because: You are on the CC list for the bug. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 6 RFC] manifest: introduce an accessor class for manifests
This series is RFC because it conflicts with my V5 manifest series that is out. These patches remove the circular dependency between manifestlog and localrepo by adding a manifestaccessor instance which provides invalidating access to the manifest revlog, so multiple objects can reference the revlog data without holding on to the repo itself. I sent this out now to get feedback since I think people may have opinions on this approach. On 11/3/16 3:27 PM, Durham Goode wrote: # HG changeset patch # User Durham Goode# Date 1478208817 25200 # Thu Nov 03 14:33:37 2016 -0700 # Branch stable # Node ID 1788ee9e1df92ac94b9be84eac6d16e3bad903a9 # Parent b9f7b0c10027764cee77f9c6d61877fcffea837f manifest: introduce an accessor class for manifests This introduces a revlogaccessor class which can be used to allow multiple objects hold an auto-invalidating reference to a revlog, without having to hold a reference to the actual repo object. Future patches will switch repo.manifest and repo.manifestlog to access the manifest through this accessor. This will fix the circular reference caused by manifestlog and manifestctx holding a reference to the repo diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -514,6 +514,11 @@ class localrepository(object): # manifest creation. return manifest.manifest(self.svfs) +@unfilteredpropertycache +def manifestaccessor(self): +return revlogaccessor('00manifest.i', self.svfs, + self._constructmanifest) + @storecache('00manifest.i') def manifestlog(self): return manifest.manifestlog(self.svfs, self) @@ -1275,6 +1280,8 @@ class localrepository(object): delattr(unfiltered, k) except AttributeError: pass +self.manifestaccessor.clear(clearfilecache) + self.invalidatecaches() if not self.currenttransaction(): # TODO: Changing contents of store outside transaction @@ -1296,6 +1303,7 @@ class localrepository(object): if k == 'dirstate' or k not in self.__dict__: continue ce.refresh() +self.manifestaccessor.refresh() def _lock(self, vfs, lockname, wait, releasefn, acquirefn, desc, inheritchecker=None, parentenvvar=None): @@ -2004,3 +2012,40 @@ def newreporequirements(repo): requirements.add('manifestv2') return requirements + +def revlogaccessor(filename, opener, constructor): +"""Creates an accessor that provides cached and invalidated access to a +revlog, via instance.revlog. This is useful for letting multiple objects +hold a reference to the revlog, without having to hold a possibly-circular +reference to the actual repository. """ + +# We have to use a runtime type here, because the only way to create a +# property is to put it on a class itself, and the property is dynamically +# defined by the filename parameter. +class accessor(object): +def __init__(self): +self._filecache = {} + +@scmutil.filecache(filename) +def revlog(self): +return constructor() + +def join(self, name): +return opener.join(name) + +def clear(self, clearfilecache): +for k in self._filecache.keys(): +if clearfilecache: +del self._filecache[k] +try: +delattr(self, k) +except AttributeError: +pass + +def refresh(self): +for k, ce in self._filecache.items(): +if k not in self.__dict__: +continue +ce.refresh() + +return accessor() diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -1254,7 +1254,7 @@ class manifestlog(object): usetreemanifest = opts.get('treemanifest', usetreemanifest) self._treeinmem = usetreemanifest -self._oldmanifest = repo._constructmanifest() +self._oldmanifest = repo.manifestaccessor.revlog self._revlog = self._oldmanifest # We'll separate this into it's own cache once oldmanifest is no longer ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://urldefense.proofpoint.com/v2/url?u=https-3A__www.mercurial-2Dscm.org_mailman_listinfo_mercurial-2Ddevel=DQIGaQ=5VD0RTtNlTh3ycd41b3MUw=nuarHzhP1wi1T9iURRCj1A=FaX7fFZjM89DjuYNmCnhnV7ZNbcHdxiC0tnJmRFQSnY=IFdLTTntCXcFrGeZCVRg9ucxucsdcssbsl8Om89v5rY= ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 5 of 6 RFC] manifest: move mancache to be a property of manifestlog
# HG changeset patch # User Durham Goode# Date 1478211830 25200 # Thu Nov 03 15:23:50 2016 -0700 # Branch stable # Node ID 1f67aef8b9b6af927ac5e34020ec737eb233c9c8 # Parent 28c62d7ed65d98732218794380629a64db7d6cf1 manifest: move mancache to be a property of manifestlog In an upcoming diff we're going to change repo.manifestlog from a storecache property to a normal propertycache. This means it will no longer ever be invalidated (the underlying revlog will be invalidated though, via the manifestaccessor). Therefore we need to make sure the mancache is retrieved from the revlog so that it gets invalidated too. Once we get rid of the manifest class entirely, we'll get rid of this strange cache sharing business entirely. diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -1254,14 +1254,16 @@ class manifestlog(object): usetreemanifest = opts.get('treemanifest', usetreemanifest) self._treeinmem = usetreemanifest -# We'll separate this into it's own cache once oldmanifest is no longer -# used -self._mancache = self._revlog._mancache - @property def _revlog(self): return self._mfaccessor.revlog +@property +def _mancache(self): +# We'll move this cache onto the manifestlog directly once the original +# manifest class goes away. +return self._revlog._mancache + def __getitem__(self, node): """Retrieves the manifest instance for the given node. Throws a KeyError if not found. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 6 RFC] manifest: make repo.manifest access via the manifestaccessor
# HG changeset patch # User Durham Goode# Date 1478209380 25200 # Thu Nov 03 14:43:00 2016 -0700 # Branch stable # Node ID 04c8f9fb517ef1755988fbae3db72df722bcd622 # Parent 89ee090611f9eecbab008678174b16b692b5c3c9 manifest: make repo.manifest access via the manifestaccessor Now that we have a layer of indirection, we don't need the manifest property to go through the manifestlog property anymore. diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -506,7 +506,7 @@ class localrepository(object): @property def manifest(self): -return self.manifestlog._oldmanifest +return self.manifestaccessor.revlog @unfilteredpropertycache def manifestaccessor(self): ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 4 of 6 RFC] manifest: replace manifestlog repo arg with manifestaccessor
# HG changeset patch # User Durham Goode# Date 1478211628 25200 # Thu Nov 03 15:20:28 2016 -0700 # Branch stable # Node ID 28c62d7ed65d98732218794380629a64db7d6cf1 # Parent 04c8f9fb517ef1755988fbae3db72df722bcd622 manifest: replace manifestlog repo arg with manifestaccessor This replaces the manifestlog and manifestctx constructor repo argument with a manifestaccessor instance. This breaks the circular dependency between localrepo and manifestlog, and means that manifestctxs no longer need to hold on to the repository object either. diff --git a/contrib/perf.py b/contrib/perf.py --- a/contrib/perf.py +++ b/contrib/perf.py @@ -407,7 +407,8 @@ def perftags(ui, repo, **opts): repocleartagscache = repocleartagscachefunc(repo) def t(): repo.changelog = mercurial.changelog.changelog(svfs) -repo.manifestlog = mercurial.manifest.manifestlog(svfs, repo) +repo.manifestlog = mercurial.manifest.manifestlog(svfs, + repo.manifestaccessor) repocleartagscache() return len(repo.tags()) timer(t) diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -519,7 +519,7 @@ class localrepository(object): @storecache('00manifest.i') def manifestlog(self): -return manifest.manifestlog(self.svfs, self) +return manifest.manifestlog(self.svfs, self.manifestaccessor) @repofilecache('dirstate') def dirstate(self): diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -1244,8 +1244,8 @@ class manifestlog(object): of the list of files in the given commit. Consumers of the output of this class do not care about the implementation details of the actual manifests they receive (i.e. tree or flat or lazily loaded, etc).""" -def __init__(self, opener, repo): -self._repo = repo +def __init__(self, opener, mfaccessor): +self._mfaccessor = mfaccessor usetreemanifest = False @@ -1254,12 +1254,13 @@ class manifestlog(object): usetreemanifest = opts.get('treemanifest', usetreemanifest) self._treeinmem = usetreemanifest -self._oldmanifest = repo.manifestaccessor.revlog -self._revlog = self._oldmanifest - # We'll separate this into it's own cache once oldmanifest is no longer # used -self._mancache = self._oldmanifest._mancache +self._mancache = self._revlog._mancache + +@property +def _revlog(self): +return self._mfaccessor.revlog def __getitem__(self, node): """Retrieves the manifest instance for the given node. Throws a KeyError @@ -1274,9 +1275,9 @@ class manifestlog(object): return cachemf if self._treeinmem: -m = treemanifestctx(self._repo, '', node) +m = treemanifestctx(self._mfaccessor, '', node) else: -m = manifestctx(self._repo, node) +m = manifestctx(self._mfaccessor, node) if node != revlog.nullid: self._mancache[node] = m return m @@ -1288,8 +1289,8 @@ class manifestctx(object): """A class representing a single revision of a manifest, including its contents, its parent revs, and its linkrev. """ -def __init__(self, repo, node): -self._repo = repo +def __init__(self, mfaccessor, node): +self._mfaccessor = mfaccessor self._data = None self._node = node @@ -1309,7 +1310,7 @@ class manifestctx(object): if self._node == revlog.nullid: self._data = manifestdict() else: -rl = self._repo.manifestlog._revlog +rl = self._mfaccessor.revlog text = rl.revision(self._node) arraytext = array.array('c', text) rl._fulltextcache[self._node] = arraytext @@ -1317,7 +1318,7 @@ class manifestctx(object): return self._data def readfast(self): -rl = self._repo.manifestlog._revlog +rl = self._mfaccessor.revlog r = rl.rev(self._node) deltaparent = rl.deltaparent(r) if deltaparent != revlog.nullrev and deltaparent in rl.parentrevs(r): @@ -1325,11 +1326,11 @@ class manifestctx(object): return self.read() def readdelta(self): -revlog = self._repo.manifestlog._revlog +revlog = self._mfaccessor.revlog if revlog._usemanifestv2: # Need to perform a slow delta r0 = revlog.deltaparent(revlog.rev(self._node)) -m0 = manifestctx(self._repo, revlog.node(r0)).read() +m0 = manifestctx(self._mfaccessor, revlog.node(r0)).read() m1 = self.read() md = manifestdict() for f, ((n0, fl0), (n1, fl1)) in m0.diff(m1).iteritems(): @@ -1344,8 +1345,8
[PATCH 6 of 6 RFC] manifest: change repo.manifestlog to be propertycache instead of storecache
# HG changeset patch # User Durham Goode# Date 1478210034 25200 # Thu Nov 03 14:53:54 2016 -0700 # Branch stable # Node ID fa009ddb7f16b81c833bd96004d6f7f33aedef10 # Parent 1f67aef8b9b6af927ac5e34020ec737eb233c9c8 manifest: change repo.manifestlog to be propertycache instead of storecache Now that all the manifest revlog invalidation happens down at the maniestaccessor layer, we can remove the invalidation that happens on the manifestlog. We also have to fix a couple of weird edge cases that try to set the manifestlog. Notably, the statichttprepo tries to construct it manually for some reason. It's not clear why this was happening, instead of just relying on the property to construct it later. diff --git a/contrib/perf.py b/contrib/perf.py --- a/contrib/perf.py +++ b/contrib/perf.py @@ -407,8 +407,7 @@ def perftags(ui, repo, **opts): repocleartagscache = repocleartagscachefunc(repo) def t(): repo.changelog = mercurial.changelog.changelog(svfs) -repo.manifestlog = mercurial.manifest.manifestlog(svfs, - repo.manifestaccessor) +repo.manifestaccessor.clear(True) repocleartagscache() return len(repo.tags()) timer(t) diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -517,7 +517,7 @@ class localrepository(object): return revlogaccessor('00manifest.i', svfs, _constructmanifest) -@storecache('00manifest.i') +@unfilteredpropertycache def manifestlog(self): return manifest.manifestlog(self.svfs, self.manifestaccessor) diff --git a/mercurial/statichttprepo.py b/mercurial/statichttprepo.py --- a/mercurial/statichttprepo.py +++ b/mercurial/statichttprepo.py @@ -18,7 +18,6 @@ from . import ( changelog, error, localrepo, -manifest, namespaces, scmutil, store, @@ -155,8 +154,6 @@ class statichttprepository(localrepo.loc self._filecache = {} self.requirements = requirements -self.manifestlog = manifest.manifestlog(self.svfs, -self.manifestaccessor) self.changelog = changelog.changelog(self.svfs) self._tags = None self.nodetagscache = None ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 6 RFC] manifest: introduce an accessor class for manifests
# HG changeset patch # User Durham Goode# Date 1478208817 25200 # Thu Nov 03 14:33:37 2016 -0700 # Branch stable # Node ID 1788ee9e1df92ac94b9be84eac6d16e3bad903a9 # Parent b9f7b0c10027764cee77f9c6d61877fcffea837f manifest: introduce an accessor class for manifests This introduces a revlogaccessor class which can be used to allow multiple objects hold an auto-invalidating reference to a revlog, without having to hold a reference to the actual repo object. Future patches will switch repo.manifest and repo.manifestlog to access the manifest through this accessor. This will fix the circular reference caused by manifestlog and manifestctx holding a reference to the repo diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -514,6 +514,11 @@ class localrepository(object): # manifest creation. return manifest.manifest(self.svfs) +@unfilteredpropertycache +def manifestaccessor(self): +return revlogaccessor('00manifest.i', self.svfs, + self._constructmanifest) + @storecache('00manifest.i') def manifestlog(self): return manifest.manifestlog(self.svfs, self) @@ -1275,6 +1280,8 @@ class localrepository(object): delattr(unfiltered, k) except AttributeError: pass +self.manifestaccessor.clear(clearfilecache) + self.invalidatecaches() if not self.currenttransaction(): # TODO: Changing contents of store outside transaction @@ -1296,6 +1303,7 @@ class localrepository(object): if k == 'dirstate' or k not in self.__dict__: continue ce.refresh() +self.manifestaccessor.refresh() def _lock(self, vfs, lockname, wait, releasefn, acquirefn, desc, inheritchecker=None, parentenvvar=None): @@ -2004,3 +2012,40 @@ def newreporequirements(repo): requirements.add('manifestv2') return requirements + +def revlogaccessor(filename, opener, constructor): +"""Creates an accessor that provides cached and invalidated access to a +revlog, via instance.revlog. This is useful for letting multiple objects +hold a reference to the revlog, without having to hold a possibly-circular +reference to the actual repository. """ + +# We have to use a runtime type here, because the only way to create a +# property is to put it on a class itself, and the property is dynamically +# defined by the filename parameter. +class accessor(object): +def __init__(self): +self._filecache = {} + +@scmutil.filecache(filename) +def revlog(self): +return constructor() + +def join(self, name): +return opener.join(name) + +def clear(self, clearfilecache): +for k in self._filecache.keys(): +if clearfilecache: +del self._filecache[k] +try: +delattr(self, k) +except AttributeError: +pass + +def refresh(self): +for k, ce in self._filecache.items(): +if k not in self.__dict__: +continue +ce.refresh() + +return accessor() diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -1254,7 +1254,7 @@ class manifestlog(object): usetreemanifest = opts.get('treemanifest', usetreemanifest) self._treeinmem = usetreemanifest -self._oldmanifest = repo._constructmanifest() +self._oldmanifest = repo.manifestaccessor.revlog self._revlog = self._oldmanifest # We'll separate this into it's own cache once oldmanifest is no longer ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 6 RFC] manifest: break reference cycle of manifestaccessor and localrepo
# HG changeset patch # User Durham Goode# Date 1478211020 25200 # Thu Nov 03 15:10:20 2016 -0700 # Branch stable # Node ID 89ee090611f9eecbab008678174b16b692b5c3c9 # Parent 1788ee9e1df92ac94b9be84eac6d16e3bad903a9 manifest: break reference cycle of manifestaccessor and localrepo Since our manifestaccessor held a reference to localrepo._constructmanifest, it caused a reference cycle. This patch breaks that cycle. bundlerepo and unionrepo abuse the manifest/repo relationship a bit more, so for now they maintain the reference cycle. diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py --- a/mercurial/bundlerepo.py +++ b/mercurial/bundlerepo.py @@ -353,6 +353,11 @@ class bundlerepository(localrepo.localre return m @localrepo.unfilteredpropertycache +def manifestaccessor(self): +return localrepo.revlogaccessor('00manifest.i', self.svfs, +self._constructmanifest) + +@localrepo.unfilteredpropertycache def manstart(self): self.changelog return self.manstart diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -508,16 +508,14 @@ class localrepository(object): def manifest(self): return self.manifestlog._oldmanifest -def _constructmanifest(self): -# This is a temporary function while we migrate from manifest to -# manifestlog. It allows bundlerepo and unionrepo to intercept the -# manifest creation. -return manifest.manifest(self.svfs) - @unfilteredpropertycache def manifestaccessor(self): -return revlogaccessor('00manifest.i', self.svfs, - self._constructmanifest) +svfs = self.svfs +def _constructmanifest(): +return manifest.manifest(svfs) + +return revlogaccessor('00manifest.i', svfs, + _constructmanifest) @storecache('00manifest.i') def manifestlog(self): diff --git a/mercurial/unionrepo.py b/mercurial/unionrepo.py --- a/mercurial/unionrepo.py +++ b/mercurial/unionrepo.py @@ -212,6 +212,11 @@ class unionrepository(localrepo.localrep return unionmanifest(self.svfs, self.repo2.svfs, self.unfiltered()._clrev) +@localrepo.unfilteredpropertycache +def manifestaccessor(self): +return localrepo.revlogaccessor('00manifest.i', self.svfs, +self._constructmanifest) + def url(self): return self._url ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 5 rfc] bdiff: rearrange the better longest match code
# HG changeset patch # User Mads Kiilerich# Date 1478208837 -3600 # Thu Nov 03 22:33:57 2016 +0100 # Node ID a3e3c7075c3c4b92e6b8c27e28bef7b2c061008d # Parent c593308da04e9144da01a08401d886a64985c74b bdiff: rearrange the better longest match code Primarily to make the code more managable and prepare for later changes. More specific assignments might also be slightly faster, even thought it also might generate a bit more code. diff --git a/mercurial/bdiff.c b/mercurial/bdiff.c --- a/mercurial/bdiff.c +++ b/mercurial/bdiff.c @@ -172,10 +172,20 @@ static int longest_match(struct bdiff_li /* best match so far? we prefer matches closer to the middle to balance recursion */ - if (k > mk || (k == mk && (i <= mi || i <= half))) { + if (k > mk) { + /* a longer match is always better */ mi = i; mj = j; mk = k; + } else if (k == mk) { + if (i > mi && i <= half) { + /* better i in first lower half */ + mi = i; + mj = j; + } else if (i == mi) { + /* an earlier j is "better" */ + mj = j; + } } } } ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 5 of 5 rfc] bdiff: make sure we append to repeated lines instead of inserting into range
# HG changeset patch # User Mads Kiilerich# Date 1478208837 -3600 # Thu Nov 03 22:33:57 2016 +0100 # Node ID be83c5f4ec8931cb7e771a80a3ef5e2042a005c1 # Parent 3e0216b2a0995cb21946bc13fb21391013332c57 bdiff: make sure we append to repeated lines instead of inserting into range This will mitigate the symptoms that tests exposed in the previous changeset. Arguably, we need similar handling for longer sequences of repeated lines... But also, we already have examples of how the heuristics handle other cases in a similar way. diff --git a/mercurial/bdiff.c b/mercurial/bdiff.c --- a/mercurial/bdiff.c +++ b/mercurial/bdiff.c @@ -187,7 +187,7 @@ static int longest_match(struct bdiff_li } else if (i == mi && findbetterb) { /* better j in first upper half */ mj = j; - if (j <= bhalf) + if (j <= bhalf && !(j > 0 && k == 1 && b[j - 1].e == b[j].e)) findbetterb = 0; } } diff --git a/tests/test-annotate.t b/tests/test-annotate.t --- a/tests/test-annotate.t +++ b/tests/test-annotate.t @@ -91,8 +91,8 @@ annotate (JSON) annotate -n b $ hg annotate -n b + 0: a 1: a - 0: a 1: a 3: b4 3: b5 @@ -111,8 +111,8 @@ annotate --no-follow b annotate -nl b $ hg annotate -nl b - 1:1: a 0:1: a + 1:2: a 1:3: a 3:4: b4 3:5: b5 @@ -121,8 +121,8 @@ annotate -nl b annotate -nf b $ hg annotate -nf b + 0 a: a 1 a: a - 0 a: a 1 a: a 3 b: b4 3 b: b5 @@ -131,8 +131,8 @@ annotate -nf b annotate -nlf b $ hg annotate -nlf b - 1 a:1: a 0 a:1: a + 1 a:2: a 1 a:3: a 3 b:4: b4 3 b:5: b5 @@ -156,8 +156,8 @@ annotate -nlf b annotate after merge $ hg annotate -nf b + 0 a: a 1 a: a - 0 a: a 1 a: a 3 b: b4 4 b: c @@ -166,8 +166,8 @@ annotate after merge annotate after merge with -l $ hg annotate -nlf b - 1 a:1: a 0 a:1: a + 1 a:2: a 1 a:3: a 3 b:4: b4 4 b:5: c @@ -198,7 +198,7 @@ annotate after merge with -l annotate after rename merge $ hg annotate -nf b - 1 a: a + 0 a: a 6 b: z 1 a: a 3 b: b4 @@ -209,7 +209,7 @@ annotate after rename merge annotate after rename merge with -l $ hg annotate -nlf b - 1 a:1: a + 0 a:1: a 6 b:2: z 1 a:3: a 3 b:4: b4 @@ -226,7 +226,7 @@ Issue2807: alignment of line numbers wit $ echo more >> b $ hg ci -mmore -d '7 0' $ hg annotate -nlf b - 1 a: 1: a + 0 a: 1: a 6 b: 2: z 1 a: 3: a 3 b: 4: b4 @@ -240,15 +240,15 @@ Issue2807: alignment of line numbers wit linkrev vs rev $ hg annotate -r tip -n a + 0: a 1: a - 0: a 1: a linkrev vs rev with -l $ hg annotate -r tip -nl a - 1:1: a 0:1: a + 1:2: a 1:3: a Issue589: "undelete" sequence leads to crash diff --git a/tests/test-bhalf.t b/tests/test-bhalf.t --- a/tests/test-bhalf.t +++ b/tests/test-bhalf.t @@ -105,8 +105,8 @@ Explore some bdiff implementation edge c --- a/x +++ b/x @@ -1,1 +1,3 @@ + a +a - a +a diff --git a/y b/y --- a/y diff --git a/tests/test-commit-amend.t b/tests/test-commit-amend.t --- a/tests/test-commit-amend.t +++ b/tests/test-commit-amend.t @@ -47,8 +47,8 @@ Amending changeset with changes in worki --- a/a Thu Jan 01 00:00:00 1970 + +++ b/a Thu Jan 01 00:00:00 1970 + @@ -1,1 +1,3 @@ + a +a - a +a $ hg log changeset: 1:43f1ba15f28a @@ -122,13 +122,13 @@ No changes, just a different message: uncompressed size of bundle content: 254 (changelog) 163 (manifests) - 141 a + 129 a saved backup bundle to $TESTTMP/.hg/strip-backup/74609c7f506e-1bfde511-amend-backup.hg (glob) 1 changesets found uncompressed size of bundle content: 250 (changelog) 163 (manifests) - 141 a + 129 a adding branch adding changesets adding manifests @@ -140,8 +140,8 @@ No changes, just a different message: --- a/a Thu Jan 01 00:00:00 1970 + +++ b/a Thu Jan 01 00:00:00 1970 + @@ -1,1 +1,3 @@ + a +a - a +a $ hg log changeset: 1:1cd866679df8 @@ -266,13 +266,13 @@ then, test editing custom commit message uncompressed size of bundle content: 249 (changelog) 163 (manifests) - 143 a + 131 a saved backup bundle to $TESTTMP/.hg/strip-backup/5f357c7560ab-e7c84ade-amend-backup.hg (glob) 1 changesets found uncompressed size of bundle content: 257 (changelog) 163 (manifests) - 143 a + 131 a adding branch adding changesets adding manifests @@ -309,13 +309,13 @@ Same, but with changes in working dir (d uncompressed size of bundle content: 464 (changelog) 322 (manifests) - 261 a + 249
[PATCH 1 of 5 rfc] tests: explore some bdiff cases
# HG changeset patch # User Mads Kiilerich# Date 1478208837 -3600 # Thu Nov 03 22:33:57 2016 +0100 # Node ID f6408efe0d0f4179fe6cc2b967164c1b4567f3d6 # Parent d06c049695e6ad3219e7479c65ce98a2f123e878 tests: explore some bdiff cases diff --git a/tests/test-bhalf.t b/tests/test-bhalf.t new file mode 100644 --- /dev/null +++ b/tests/test-bhalf.t @@ -0,0 +1,140 @@ +A couple of test cases exploring the bdiff implementation. + +Diff of boring files: + + $ hg init repo1 + $ cd repo1 + $ (for i in `seq 15`; do echo "once upon a time $i"; echo "The quick brown fox jumps over the lazy dog"; done; echo) > this-is-the-filename + $ hg add this-is-the-filename + $ hg ci -m "commit message commit message commit message commit message commit message commit message commit message commit message" + $ (for i in `seq 15`; do echo "twice upon a time $i"; echo "The quick brown fox jumps over the lazy dog"; done; echo) > this-is-the-filename + $ hg diff --git + diff --git a/this-is-the-filename b/this-is-the-filename + --- a/this-is-the-filename + +++ b/this-is-the-filename + @@ -1,31 +1,31 @@ + -once upon a time 1 + -The quick brown fox jumps over the lazy dog + -once upon a time 2 + -The quick brown fox jumps over the lazy dog + -once upon a time 3 + -The quick brown fox jumps over the lazy dog + -once upon a time 4 + -The quick brown fox jumps over the lazy dog + -once upon a time 5 + -The quick brown fox jumps over the lazy dog + -once upon a time 6 + -The quick brown fox jumps over the lazy dog + -once upon a time 7 + +twice upon a time 1 + The quick brown fox jumps over the lazy dog + -once upon a time 8 + -The quick brown fox jumps over the lazy dog + -once upon a time 9 + -The quick brown fox jumps over the lazy dog + -once upon a time 10 + +twice upon a time 2 + The quick brown fox jumps over the lazy dog + -once upon a time 11 + -The quick brown fox jumps over the lazy dog + -once upon a time 12 + +twice upon a time 3 + The quick brown fox jumps over the lazy dog + -once upon a time 13 + +twice upon a time 4 + The quick brown fox jumps over the lazy dog + -once upon a time 14 + +twice upon a time 5 + The quick brown fox jumps over the lazy dog + -once upon a time 15 + +twice upon a time 6 + +The quick brown fox jumps over the lazy dog + +twice upon a time 7 + +The quick brown fox jumps over the lazy dog + +twice upon a time 8 + +The quick brown fox jumps over the lazy dog + +twice upon a time 9 + +The quick brown fox jumps over the lazy dog + +twice upon a time 10 + +The quick brown fox jumps over the lazy dog + +twice upon a time 11 + +The quick brown fox jumps over the lazy dog + +twice upon a time 12 + +The quick brown fox jumps over the lazy dog + +twice upon a time 13 + +The quick brown fox jumps over the lazy dog + +twice upon a time 14 + +The quick brown fox jumps over the lazy dog + +twice upon a time 15 + The quick brown fox jumps over the lazy dog + +That's an odd diff for a trivial change! + + $ hg ci -m "commit message commit message commit message commit message commit message commit message commit message commit message" + $ hg bundle --base null ../bundle.hg + 2 changesets found + $ cd .. + + $ f --size bundle.hg + bundle.hg: size=878 + +Explore some bdiff implementation edge cases: + + $ hg init repo2 + $ cd repo2 + $ cat << EOF >> x + > a + > EOF + $ cat << EOF >> y + > a + > a + > a + > EOF + $ cat << EOF >> z + > a + > a + > a + > a + > a + > EOF + $ hg ci -qAm0 + $ cat << EOF > x + > a + > a + > a + > EOF + $ cat << EOF > y + > a + > EOF + $ cat << EOF > z + > a + > EOF + $ hg diff --git + diff --git a/x b/x + --- a/x + +++ b/x + @@ -1,1 +1,3 @@ + a + +a + +a + diff --git a/y b/y + --- a/y + +++ b/y + @@ -1,3 +1,1 @@ + a + -a + -a + diff --git a/z b/z + --- a/z + +++ b/z + @@ -1,5 +1,1 @@ + -a + a + -a + -a + -a + +x and y shows the preference for adding / removing at the end of sequences ... +z just seems weird. + + $ cd .. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 5 rfc] bdiff: adjust criteria for getting optimal longest match in the middle
# HG changeset patch # User Mads Kiilerich# Date 1478208837 -3600 # Thu Nov 03 22:33:57 2016 +0100 # Node ID c593308da04e9144da01a08401d886a64985c74b # Parent f6408efe0d0f4179fe6cc2b967164c1b4567f3d6 bdiff: adjust criteria for getting optimal longest match in the middle We prefer matches closer to the middle to balance recursion, as introduced in f1ca249696ed. For ranges with uneven length, matches starting exactly in the middle should have preference. That will be optimal for matches of length 1. We will thus accept equality in the half check. For ranges with even length, half was ceil'ed when calculated but we got the preference for low matches from the 'less than half' check. To get the same result as before when we also accept equality, floor it. Without that, test-annotate.t would show some different (still correct but less optimal) results. This will change the heuristics. Tests shows a slightly different output - and sometimes slightly smaller bundles. diff --git a/mercurial/bdiff.c b/mercurial/bdiff.c --- a/mercurial/bdiff.c +++ b/mercurial/bdiff.c @@ -146,7 +146,7 @@ static int longest_match(struct bdiff_li if (a2 - a1 > 3) a1 = a2 - 3; - half = (a1 + a2) / 2; + half = (a1 + a2 - 1) / 2; for (i = a1; i < a2; i++) { /* skip all lines in b after the current block */ @@ -172,7 +172,7 @@ static int longest_match(struct bdiff_li /* best match so far? we prefer matches closer to the middle to balance recursion */ - if (k > mk || (k == mk && (i <= mi || i < half))) { + if (k > mk || (k == mk && (i <= mi || i <= half))) { mi = i; mj = j; mk = k; diff --git a/tests/test-bhalf.t b/tests/test-bhalf.t --- a/tests/test-bhalf.t +++ b/tests/test-bhalf.t @@ -33,20 +33,21 @@ Diff of boring files: -once upon a time 9 -The quick brown fox jumps over the lazy dog -once upon a time 10 + -The quick brown fox jumps over the lazy dog + -once upon a time 11 +twice upon a time 2 The quick brown fox jumps over the lazy dog - -once upon a time 11 + -once upon a time 12 -The quick brown fox jumps over the lazy dog - -once upon a time 12 + -once upon a time 13 +twice upon a time 3 The quick brown fox jumps over the lazy dog - -once upon a time 13 + -once upon a time 14 +twice upon a time 4 The quick brown fox jumps over the lazy dog - -once upon a time 14 + -once upon a time 15 +twice upon a time 5 - The quick brown fox jumps over the lazy dog - -once upon a time 15 + +The quick brown fox jumps over the lazy dog +twice upon a time 6 +The quick brown fox jumps over the lazy dog +twice upon a time 7 @@ -76,7 +77,7 @@ That's an odd diff for a trivial change! $ cd .. $ f --size bundle.hg - bundle.hg: size=878 + bundle.hg: size=870 Explore some bdiff implementation edge cases: @@ -121,20 +122,21 @@ Explore some bdiff implementation edge c --- a/y +++ b/y @@ -1,3 +1,1 @@ + -a a -a - -a diff --git a/z b/z --- a/z +++ b/z @@ -1,5 +1,1 @@ -a + -a a -a -a - -a -x and y shows the preference for adding / removing at the end of sequences ... -z just seems weird. +x shows the preference for adding at the end of sequences ... +while y and z shows the preference for balanced recursion +which is more efficient in stack and performance. $ cd .. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@30259: 4 new changesets
4 new changesets in mercurial: http://selenic.com/repo/hg//rev/2ed0b3f9f79e changeset: 30256:2ed0b3f9f79e user:Gregory Szorcdate:Tue Nov 01 18:55:30 2016 -0700 summary: statprof: use absolute_imports http://selenic.com/repo/hg//rev/7428223ed7c2 changeset: 30257:7428223ed7c2 user:Gregory Szorc date:Sun Aug 14 19:20:12 2016 -0700 summary: statprof: use print function http://selenic.com/repo/hg//rev/eea89068a98d changeset: 30258:eea89068a98d user:Gregory Szorc date:Tue Nov 01 19:03:11 2016 -0700 summary: statprof: pass data structure to display functions http://selenic.com/repo/hg//rev/d06c049695e6 changeset: 30259:d06c049695e6 bookmark:@ tag: tip user:Gregory Szorc date:Wed Aug 17 08:52:15 2016 -0700 summary: tests: explicitly use ls profiler -- Repository URL: http://selenic.com/repo/hg/ ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 5] revlog: make commonancestorsheads accept revision numbers
On 11/02/2016 03:59 AM, Jun Wu wrote: Excerpts from Gregory Szorc's message of 2016-11-01 19:47:07 -0700: On Tue, Nov 1, 2016 at 7:25 PM, Jun Wuwrote: Excerpts from Pierre-Yves David's message of 2016-11-02 00:05:32 +0100: I think I would rather see a two methods, one for revs and one for nodes that would keep the signature of each function clearer. One of the function would probably all into the other one to keep the code common. What do you think? If we have two "commonancestorsheads"s, we will have to write two "isancestor"s. I'd avoid the contagious pattern that enforces the caller ("isancestor" in this case) to do things otherwise unnecessary. Given the fact that "repo.rev(x)" takes both node and rev. And repo[x] takes everything. I'd prefer shorter code. It can be seen as a reasonable function overloading in C++. The two commands you cite are high level function that live on a top level function, the repository. This series is touching code at the changelog/revlog level something much lower level were we try to have simpler signature and more channeled usage. I was once tempted by having more flexible argument at this level but over time things emerged as cleaner the current way (with adjusting functions from time to time). On such low level object, keeping function simpler and clear is also helpful to not oversight anything regarding performance. So I really would like to avoid this flexible argument types here. Can you submit a new version with either two methods or a single one (the simplest) and the few caller converted as Greg suggested ? I agree with Pierre-Yves here: it is too easy to fall into performance traps where functions accept either node or rev and needlessly perform type checking or dip into the index for unneeded lookups. Let's standardize on one. With list comprehensions, it's easy enough to ensure arguments are either all revs or all nodes. I do disagree about the need for 2 methods. Just standardize on whatever one makes sense and have the caller convert to that type. This may entail a The convert is not free (coverting from node -> rev requires walking through the whole index for the first 2 times). This patch is all about avoiding converting from node -> rev -> node (commonancestorsheads), and the return value is a bool (isancestor). Comparing with converting between node and rev, I think "isinstance" is a cheaper operation. It should be even much faster comparing with commonancestorsheads's C implementation. When the commonancestorsheads C implementation is the bottleneck, I don't think it's necessary to optimize those "isinstance" out is necessary. `revlog.revstonodes(revs)` or `revlog.nodestorevs(nodes)` to facilitate bulk converting iterables of 1 type to the other. -- Pierre-Yves David ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@30255: 2 new changesets
2 new changesets in mercurial: http://selenic.com/repo/hg//rev/ad4c0236168d changeset: 30254:ad4c0236168d user:Gregory Szorcdate:Sun Aug 14 19:13:32 2016 -0700 summary: statprof: fix flake8 warnings http://selenic.com/repo/hg//rev/f42cd5434cc2 changeset: 30255:f42cd5434cc2 bookmark:@ tag: tip user:Gregory Szorc date:Sun Aug 14 19:14:05 2016 -0700 summary: statprof: require paths to save or load profile data -- Repository URL: http://selenic.com/repo/hg/ ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Pre-commit hook ignoring rc
I've got a pre-commit hook written in Python that's been working ok, but all of a sudden seems to be ignoring the return value. I return True if I don't want to commit to proceed. But it's committing anyway. Running 3.9.2. Has anything changed recently? Peter ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 5 of 5] adjustlinkrev: remove unnecessary parameters
On 11/02/2016 03:45 AM, Jun Wu wrote: Excerpts from Pierre-Yves David's message of 2016-11-02 03:35:34 +0100: On 11/02/2016 03:15 AM, Jun Wu wrote: Excerpts from Pierre-Yves David's message of 2016-11-02 02:53:52 +0100: I would like something a bit more tangible than "I believe" for example the changeset that made it a method without cleaning the argument. It might contains data about why it did not cleaned them up. See 087603b50889. It does not contain data why it did not cleaned them up. The commit message does not says anything, but the last hunk probably have the answer. In the last hunk the path the path, filelog and filenode are not taken from "self" because we are adjusting link for parent filelog we are creating. It seems like the code evolve and such operation do not happen anymore (probably because the parent is lazily responsible to adjust its likerev if needed. Can you double check that all trace of this is now gone? If we, I'm happy to take a signature simplification :-) I have done this when writing the patch. This is the second check: Searching all "_adjustlinkrev" from the repo (at 264f00): quark % ack _adjustlinkrev mercurial/context.py 683:return self._adjustlinkrev(self._path, self._filelog, <<< 811:def _adjustlinkrev(self, path, filelog, fnode, srcrev, inclusive=False): 874:return self._adjustlinkrev(self._path, self._filelog, self._filenode, <<< 878:"""create parent filectx keeping ancestry info for _adjustlinkrev()""" 884:# This lets us later use _adjustlinkrev to get a correct link. 955:# adjustment. Otherwise, p._adjustlinkrev() would walk changelog We only have 2 callers of _adjustlinkrev, both using self._path, _filelog and _filenode. If patch 4 is dropped, this one will cause conflict. I will fix that later. I've fixed the patch in flight and pushed it. Thanks. (only patch5 is pushed) -- Pierre-Yves David ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH V2] perf: add asv benchmarks
On 11/03/2016 04:58 PM, Philippe Pepiot wrote: # HG changeset patch # User Philippe Pepiot# Date 1475136994 -7200 # Thu Sep 29 10:16:34 2016 +0200 # Node ID 67e096cea548a37ba80ddf04e62a1cc1d50e9c96 # Parent b032a7b676c6637b2ac6f3ef29431013b15a08f9 perf: add asv benchmarks Here is my own review Airspeed velocity (ASV) is a python framework for benchmarking Python packages over their lifetime. The results are displayed in an interactive web frontend. Add ASV benchmarks for mercurial that use contrib/perf.py extension that could be run against multiple reference repositories. The benchmark suite now includes revsets from contrib/base-revsets.txt with variants, perftags, perfstatus, perfmanifest and perfheads. Installation requires asv>=0.2, python-hglib and virtualenv This is part of PerformanceTrackingSuitePlan https://www.mercurial-scm.org/wiki/PerformanceTrackingSuitePlan diff --git a/.hgignore b/.hgignore --- a/.hgignore +++ b/.hgignore @@ -49,6 +49,7 @@ mercurial.egg-info tags cscope.* .idea/* +.asv/* i18n/hg.pot locale/*/LC_MESSAGES/hg.mo hgext/__index__.py diff --git a/contrib/asv.conf.json b/contrib/asv.conf.json new file mode 100644 --- /dev/null +++ b/contrib/asv.conf.json @@ -0,0 +1,127 @@ +{ +// The version of the config file format. Do not change, unless +// you know what you are doing. +"version": 1, + +// The name of the project being benchmarked +"project": "mercurial", + +// The project's homepage +"project_url": "http://mercurial-scm.org/;, + +// The URL or local path of the source code repository for the +// project being benchmarked +"repo": "..", + +// List of branches to benchmark. If not provided, defaults to "master" +// (for git) or "default" (for mercurial). +// "branches": ["master"], // for git +// "branches": ["default"],// for mercurial +"branches": ["default", "stable"], + +// The DVCS being used. If not set, it will be automatically +// determined from "repo" by looking at the protocol in the URL +// (if remote), or by looking for special directories, such as +// ".git" (if local). +// "dvcs": "git", + +// The tool to use to create environments. May be "conda", +// "virtualenv" or other value depending on the plugins in use. +// If missing or the empty string, the tool will be automatically +// determined by looking for tools on the PATH environment +// variable. +"environment_type": "virtualenv", + +// the base URL to show a commit for the project. +"show_commit_url": "https://www.mercurial-scm.org/repo/hg/rev/;, + +// The Pythons you'd like to test against. If not provided, defaults +// to the current version of Python used to run `asv`. +// "pythons": ["2.7", "3.3"], + +// The matrix of dependencies to test. Each key is the name of a +// package (in PyPI) and the values are version numbers. An empty +// list or empty string indicates to just test against the default +// (latest) version. null indicates that the package is to not be +// installed. If the package to be tested is only available from +// PyPi, and the 'environment_type' is conda, then you can preface +// the package name by 'pip+', and the package will be installed via +// pip (with all the conda available packages installed first, +// followed by the pip installed packages). +// +// "matrix": { +// "numpy": ["1.6", "1.7"], +// "six": ["", null],// test with and without six installed +// "pip+emcee": [""], // emcee is only available for install with pip. +// }, + +// Combinations of libraries/python versions can be excluded/included +// from the set to test. Each entry is a dictionary containing additional +// key-value pairs to include/exclude. +// +// An exclude entry excludes entries where all values match. The +// values are regexps that should match the whole string. +// +// An include entry adds an environment. Only the packages listed +// are installed. The 'python' key is required. The exclude rules +// do not apply to includes. +// +// In addition to package names, the following keys are available: +// +// - python +// Python version, as in the *pythons* variable above. +// - environment_type +// Environment type, as above. +// - sys_platform +// Platform, as in sys.platform. Possible values for the common +// cases: 'linux2', 'win32', 'cygwin', 'darwin'. +// +// "exclude": [ +// {"python": "3.2", "sys_platform": "win32"}, // skip py3.2 on windows +// {"environment_type": "conda", "six": null}, // don't run without six on conda +// ], +// +// "include": [ +// // additional env for python2.7 +// {"python": "2.7", "numpy": "1.8"}, +// // additional env if run on windows+conda +
Re: [PATCH 3 of 3] rebase: check for conflicts before continuing
On 11/02/2016 08:01 PM, timeless wrote: # HG changeset patch # User timeless# Date 1478113169 0 # Wed Nov 02 18:59:29 2016 + # Node ID e9528bc734ce94456dd2389b4ea318278139c206 # Parent 8dae4ad6767cf3456dd2fc4b2a7b478d855091f7 # Available At https://bitbucket.org/timeless/mercurial-crew # hg pull https://bitbucket.org/timeless/mercurial-crew -r e9528bc734ce rebase: check for conflicts before continuing Pushed these one, thanks. -- Pierre-Yves David ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH V2] perf: add asv benchmarks
# HG changeset patch # User Philippe Pepiot# Date 1475136994 -7200 # Thu Sep 29 10:16:34 2016 +0200 # Node ID 67e096cea548a37ba80ddf04e62a1cc1d50e9c96 # Parent b032a7b676c6637b2ac6f3ef29431013b15a08f9 perf: add asv benchmarks Airspeed velocity (ASV) is a python framework for benchmarking Python packages over their lifetime. The results are displayed in an interactive web frontend. Add ASV benchmarks for mercurial that use contrib/perf.py extension that could be run against multiple reference repositories. The benchmark suite now includes revsets from contrib/base-revsets.txt with variants, perftags, perfstatus, perfmanifest and perfheads. Installation requires asv>=0.2, python-hglib and virtualenv This is part of PerformanceTrackingSuitePlan https://www.mercurial-scm.org/wiki/PerformanceTrackingSuitePlan diff --git a/.hgignore b/.hgignore --- a/.hgignore +++ b/.hgignore @@ -49,6 +49,7 @@ mercurial.egg-info tags cscope.* .idea/* +.asv/* i18n/hg.pot locale/*/LC_MESSAGES/hg.mo hgext/__index__.py diff --git a/contrib/asv.conf.json b/contrib/asv.conf.json new file mode 100644 --- /dev/null +++ b/contrib/asv.conf.json @@ -0,0 +1,127 @@ +{ +// The version of the config file format. Do not change, unless +// you know what you are doing. +"version": 1, + +// The name of the project being benchmarked +"project": "mercurial", + +// The project's homepage +"project_url": "http://mercurial-scm.org/;, + +// The URL or local path of the source code repository for the +// project being benchmarked +"repo": "..", + +// List of branches to benchmark. If not provided, defaults to "master" +// (for git) or "default" (for mercurial). +// "branches": ["master"], // for git +// "branches": ["default"],// for mercurial +"branches": ["default", "stable"], + +// The DVCS being used. If not set, it will be automatically +// determined from "repo" by looking at the protocol in the URL +// (if remote), or by looking for special directories, such as +// ".git" (if local). +// "dvcs": "git", + +// The tool to use to create environments. May be "conda", +// "virtualenv" or other value depending on the plugins in use. +// If missing or the empty string, the tool will be automatically +// determined by looking for tools on the PATH environment +// variable. +"environment_type": "virtualenv", + +// the base URL to show a commit for the project. +"show_commit_url": "https://www.mercurial-scm.org/repo/hg/rev/;, + +// The Pythons you'd like to test against. If not provided, defaults +// to the current version of Python used to run `asv`. +// "pythons": ["2.7", "3.3"], + +// The matrix of dependencies to test. Each key is the name of a +// package (in PyPI) and the values are version numbers. An empty +// list or empty string indicates to just test against the default +// (latest) version. null indicates that the package is to not be +// installed. If the package to be tested is only available from +// PyPi, and the 'environment_type' is conda, then you can preface +// the package name by 'pip+', and the package will be installed via +// pip (with all the conda available packages installed first, +// followed by the pip installed packages). +// +// "matrix": { +// "numpy": ["1.6", "1.7"], +// "six": ["", null],// test with and without six installed +// "pip+emcee": [""], // emcee is only available for install with pip. +// }, + +// Combinations of libraries/python versions can be excluded/included +// from the set to test. Each entry is a dictionary containing additional +// key-value pairs to include/exclude. +// +// An exclude entry excludes entries where all values match. The +// values are regexps that should match the whole string. +// +// An include entry adds an environment. Only the packages listed +// are installed. The 'python' key is required. The exclude rules +// do not apply to includes. +// +// In addition to package names, the following keys are available: +// +// - python +// Python version, as in the *pythons* variable above. +// - environment_type +// Environment type, as above. +// - sys_platform +// Platform, as in sys.platform. Possible values for the common +// cases: 'linux2', 'win32', 'cygwin', 'darwin'. +// +// "exclude": [ +// {"python": "3.2", "sys_platform": "win32"}, // skip py3.2 on windows +// {"environment_type": "conda", "six": null}, // don't run without six on conda +// ], +// +// "include": [ +// // additional env for python2.7 +// {"python": "2.7", "numpy": "1.8"}, +// // additional env if run on windows+conda +// {"platform": "win32", "environment_type": "conda", "python": "2.7",
[PATCH 3 of 5] color: extract color and effect display from 'debugcolor'
# HG changeset patch # User Pierre-Yves David# Date 1478180927 -3600 # Thu Nov 03 14:48:47 2016 +0100 # Node ID a426f9f5c76af2ae94500d9a4c845a5d12b27bbc # Parent d2f98dbce59c7f0cfa8856ead06ad59985e23332 # EXP-Topic debugcolor color: extract color and effect display from 'debugcolor' We are about to introduce a second mode for 'hg debugcolor' that would list the known label and their configuration, so we split the code related to color and effect out of the main function. diff --git a/hgext/color.py b/hgext/color.py --- a/hgext/color.py +++ b/hgext/color.py @@ -539,6 +539,10 @@ def extsetup(ui): @command('debugcolor', [], 'hg debugcolor') def debugcolor(ui, repo, **opts): """show available colors and effects""" +ui.write(('color mode: %s\n') % ui._colormode) +return _debugdisplaycolor(ui) + +def _debugdisplaycolor(ui): global _styles oldstyle = _styles try: @@ -551,7 +555,6 @@ def debugcolor(ui, repo, **opts): _styles[k] = k[6:] elif k.startswith('terminfo.'): _styles[k] = k[9:] -ui.write(('color mode: %s\n') % ui._colormode) ui.write(_('available colors:\n')) for colorname, label in _styles.items(): ui.write(('%s\n') % colorname, label=label) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 5] color: restore _style global after debugcolor ran
# HG changeset patch # User Pierre-Yves David# Date 1478179759 -3600 # Thu Nov 03 14:29:19 2016 +0100 # Node ID d2f98dbce59c7f0cfa8856ead06ad59985e23332 # Parent eb48068030c410636db6c862921f1c3b3372601d # EXP-Topic debugcolor color: restore _style global after debugcolor ran Before this change, running 'debugcolor' would destroy all color style for the rest of the process life. We now properly backup and restore the variable content. Using a global variable is sketchy in general and could probably be removed. However, this is a quest for another adventure. diff --git a/hgext/color.py b/hgext/color.py --- a/hgext/color.py +++ b/hgext/color.py @@ -540,19 +540,23 @@ def extsetup(ui): def debugcolor(ui, repo, **opts): """show available colors and effects""" global _styles -_styles = {} -for effect in _effects.keys(): -_styles[effect] = effect -if _terminfo_params: -for k, v in ui.configitems('color'): -if k.startswith('color.'): -_styles[k] = k[6:] -elif k.startswith('terminfo.'): -_styles[k] = k[9:] -ui.write(('color mode: %s\n') % ui._colormode) -ui.write(_('available colors:\n')) -for colorname, label in _styles.items(): -ui.write(('%s\n') % colorname, label=label) +oldstyle = _styles +try: +_styles = {} +for effect in _effects.keys(): +_styles[effect] = effect +if _terminfo_params: +for k, v in ui.configitems('color'): +if k.startswith('color.'): +_styles[k] = k[6:] +elif k.startswith('terminfo.'): +_styles[k] = k[9:] +ui.write(('color mode: %s\n') % ui._colormode) +ui.write(_('available colors:\n')) +for colorname, label in _styles.items(): +ui.write(('%s\n') % colorname, label=label) +finally: +_styles = oldstyle if os.name != 'nt': w32effects = None ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 5] color: add basic documentation to 'debugcolor'
# HG changeset patch # User Pierre-Yves David# Date 1478178752 -3600 # Thu Nov 03 14:12:32 2016 +0100 # Node ID eb48068030c410636db6c862921f1c3b3372601d # Parent b032a7b676c6637b2ac6f3ef29431013b15a08f9 # EXP-Topic debugcolor color: add basic documentation to 'debugcolor' This does not hurt. diff --git a/hgext/color.py b/hgext/color.py --- a/hgext/color.py +++ b/hgext/color.py @@ -538,6 +538,7 @@ def extsetup(ui): @command('debugcolor', [], 'hg debugcolor') def debugcolor(ui, repo, **opts): +"""show available colors and effects""" global _styles _styles = {} for effect in _effects.keys(): ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 2 of 2] context: make sure __str__ works, also when there is no _changectx
On 11/02/2016 04:25 PM, Mads Kiilerich wrote: # HG changeset patch # User Mads Kiilerich# Date 1426800170 -3600 # Thu Mar 19 22:22:50 2015 +0100 # Node ID 4b06a40809d781e9aba54718ec2fe1a232d81956 # Parent 90300200bc1fcaedcc6ab109574d08b01ece2853 context: make sure __str__ works, also when there is no _changectx These two are pushed, thanks. -- Pierre-Yves David ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 2 of 2] changegroup: use changelogrevision()
On 11/02/2016 02:29 AM, Gregory Szorc wrote: # HG changeset patch # User Gregory Szorc# Date 1478050149 25200 # Tue Nov 01 18:29:09 2016 -0700 # Node ID 0bf5f704d2d99965df476e5e90a517b805ee08aa # Parent 9cd491f108689228e93b1247772aba56786afcd7 changegroup: use changelogrevision() I've pushed this two. I would be happier to see some performance number attached, but they seems reasonable enough that I took them. Thanks! -- Pierre-Yves David ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] make: targets for building packages for ubuntu yakkety
On 11/02/2016 02:49 AM, Gregory Szorc wrote: # HG changeset patch # User Gregory Szorc# Date 1478051363 25200 # Tue Nov 01 18:49:23 2016 -0700 # Node ID 8c47e896413be961ece5e585f883e0ce7e4b684d # Parent e5cc44ea12de681d971fcbebb65a7fb71fd1c3c7 make: targets for building packages for ubuntu yakkety Ubuntu 16.10 Yakkety Yak is out. Let's support it. I've pushed that one, thanks. -- Pierre-Yves David ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 4] test: rename 'test-push-r.t' to 'test-push.t'
# HG changeset patch # User Pierre-Yves David# Date 1478145526 -3600 # Thu Nov 03 04:58:46 2016 +0100 # Node ID 2df91e4f382100ec1f5c835bfe2c23081b415ce0 # Parent 88c6789dedad1ca6bf4d4323b7332e76f233b531 # EXP-Topic pushtest test: rename 'test-push-r.t' to 'test-push.t' We do not have a simple test for 'hg push' but we have multiple tiny tests for various aspect of it. We'll unify them into a single file, and we start with 'test-push-r.t'. The code is unchanged but we renamed the repository used to avoid collision with other tests we'll import in coming changesets. Test timing for the record: start end cuser csysreal Test 1.850 2.640 0.650 0.090 0.790 test-push-validation.t 2.640 3.520 0.760 0.090 0.880 test-push-hook-lock.t 0.000 1.850 1.560 0.210 1.850 test-push-r.t diff --git a/tests/test-push-r.t b/tests/test-push.t rename from tests/test-push-r.t rename to tests/test-push.t --- a/tests/test-push-r.t +++ b/tests/test-push.t @@ -1,5 +1,12 @@ - $ hg init test - $ hg -R test unbundle "$TESTDIR/bundles/remote.hg" +== +Basic testing for the push command +== + +Testing of the '--rev' flag +=== + + $ hg init test-revflag + $ hg -R test-revflag unbundle "$TESTDIR/bundles/remote.hg" adding changesets adding manifests adding file changes @@ -8,12 +15,12 @@ $ for i in 0 1 2 3 4 5 6 7 8; do >echo - >hg init test-"$i" - >hg -R test push -r "$i" test-"$i" - >hg -R test-"$i" verify + >hg init test-revflag-"$i" + >hg -R test-revflag push -r "$i" test-revflag-"$i" + >hg -R test-revflag-"$i" verify > done - pushing to test-0 + pushing to test-revflag-0 searching for changes adding changesets adding manifests @@ -25,7 +32,7 @@ checking files 1 files, 1 changesets, 1 total revisions - pushing to test-1 + pushing to test-revflag-1 searching for changes adding changesets adding manifests @@ -37,7 +44,7 @@ checking files 1 files, 2 changesets, 2 total revisions - pushing to test-2 + pushing to test-revflag-2 searching for changes adding changesets adding manifests @@ -49,7 +56,7 @@ checking files 1 files, 3 changesets, 3 total revisions - pushing to test-3 + pushing to test-revflag-3 searching for changes adding changesets adding manifests @@ -61,7 +68,7 @@ checking files 1 files, 4 changesets, 4 total revisions - pushing to test-4 + pushing to test-revflag-4 searching for changes adding changesets adding manifests @@ -73,7 +80,7 @@ checking files 1 files, 2 changesets, 2 total revisions - pushing to test-5 + pushing to test-revflag-5 searching for changes adding changesets adding manifests @@ -85,7 +92,7 @@ checking files 1 files, 3 changesets, 3 total revisions - pushing to test-6 + pushing to test-revflag-6 searching for changes adding changesets adding manifests @@ -97,7 +104,7 @@ checking files 2 files, 4 changesets, 5 total revisions - pushing to test-7 + pushing to test-revflag-7 searching for changes adding changesets adding manifests @@ -109,7 +116,7 @@ checking files 3 files, 5 changesets, 6 total revisions - pushing to test-8 + pushing to test-revflag-8 searching for changes adding changesets adding manifests @@ -121,10 +128,10 @@ checking files 2 files, 5 changesets, 5 total revisions - $ cd test-8 + $ cd test-revflag-8 - $ hg pull ../test-7 - pulling from ../test-7 + $ hg pull ../test-revflag-7 + pulling from ../test-revflag-7 searching for changes adding changesets adding manifests ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 4] tests: simplify command script in 'test-push-r.t'
# HG changeset patch # User Pierre-Yves David# Date 1478145934 -3600 # Thu Nov 03 05:05:34 2016 +0100 # Node ID 88c6789dedad1ca6bf4d4323b7332e76f233b531 # Parent 6a8aff737a17ada068b8ce4501184eacc66e827f # EXP-Topic pushtest tests: simplify command script in 'test-push-r.t' I came across this code by chance. The script of this test is a bit messy with a lot of unnecessary intermediate commands. We simplify the script and unify repository access through '-R'. In the process the update after the unbundle is dropped as it does not add anything to the tests. diff --git a/tests/test-push-r.t b/tests/test-push-r.t --- a/tests/test-push-r.t +++ b/tests/test-push-r.t @@ -1,23 +1,16 @@ $ hg init test - $ cd test - $ hg unbundle "$TESTDIR/bundles/remote.hg" + $ hg -R test unbundle "$TESTDIR/bundles/remote.hg" adding changesets adding manifests adding file changes added 9 changesets with 7 changes to 4 files (+1 heads) (run 'hg heads' to see heads, 'hg merge' to merge) - $ hg up tip - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ cd .. $ for i in 0 1 2 3 4 5 6 7 8; do >echo - >mkdir test-"$i" - >hg --cwd test-"$i" init + >hg init test-"$i" >hg -R test push -r "$i" test-"$i" - >cd test-"$i" - >hg verify - >cd .. + >hg -R test-"$i" verify > done pushing to test-0 ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 4] tests: merge 'test-push-validation.t' into 'test-push.t'
# HG changeset patch # User Pierre-Yves David# Date 1478146214 -3600 # Thu Nov 03 05:10:14 2016 +0100 # Node ID d5f07aeefda46b3cd17962565940516f69ed1f56 # Parent 2df91e4f382100ec1f5c835bfe2c23081b415ce0 # EXP-Topic pushtest tests: merge 'test-push-validation.t' into 'test-push.t' That test file is very small and is merge with the new 'test-push.t'. No logic is changed but repository name are update to avoid collision. We don't register this as a copy because is actually a "ypoc" merging two file together without replacing the destination and Mercurial cannot express that. diff --git a/tests/test-push-validation.t b/tests/test-push-validation.t deleted file mode 100644 --- a/tests/test-push-validation.t +++ /dev/null @@ -1,92 +0,0 @@ - $ hg init test - $ cd test - - $ cat > .hg/hgrc < [server] - > validate=1 - > EOF - - $ echo alpha > alpha - $ echo beta > beta - $ hg addr - adding alpha - adding beta - $ hg ci -m 1 - - $ cd .. - $ hg clone test test-clone - updating to branch default - 2 files updated, 0 files merged, 0 files removed, 0 files unresolved - -Test spurious filelog entries: - - $ cd test-clone - $ echo blah >> beta - $ cp .hg/store/data/beta.i tmp1 - $ hg ci -m 2 - $ cp .hg/store/data/beta.i tmp2 - $ hg -q rollback - $ mv tmp2 .hg/store/data/beta.i - $ echo blah >> beta - $ hg ci -m '2 (corrupt)' - -Expected to fail: - - $ hg verify - checking changesets - checking manifests - crosschecking files in changesets and manifests - checking files - beta@1: dddc47b3ba30 not in manifests - 2 files, 2 changesets, 4 total revisions - 1 integrity errors encountered! - (first damaged changeset appears to be 1) - [1] - - $ hg push - pushing to $TESTTMP/test (glob) - searching for changes - adding changesets - adding manifests - adding file changes - transaction abort! - rollback completed - abort: received spurious file revlog entry - [255] - - $ hg -q rollback - $ mv tmp1 .hg/store/data/beta.i - $ echo beta > beta - -Test missing filelog entries: - - $ cp .hg/store/data/beta.i tmp - $ echo blah >> beta - $ hg ci -m '2 (corrupt)' - $ mv tmp .hg/store/data/beta.i - -Expected to fail: - - $ hg verify - checking changesets - checking manifests - crosschecking files in changesets and manifests - checking files - beta@1: manifest refers to unknown revision dddc47b3ba30 - 2 files, 2 changesets, 2 total revisions - 1 integrity errors encountered! - (first damaged changeset appears to be 1) - [1] - - $ hg push - pushing to $TESTTMP/test (glob) - searching for changes - adding changesets - adding manifests - adding file changes - transaction abort! - rollback completed - abort: missing file data for beta:dddc47b3ba30e54484720ce0f4f768a0f4b6efb9 - run hg verify - [255] - - $ cd .. diff --git a/tests/test-push.t b/tests/test-push.t --- a/tests/test-push.t +++ b/tests/test-push.t @@ -147,3 +147,99 @@ Testing of the '--rev' flag 4 files, 9 changesets, 7 total revisions $ cd .. + +Test server side validation during push +=== + + $ hg init test-validation + $ cd test-validation + + $ cat > .hg/hgrc < [server] + > validate=1 + > EOF + + $ echo alpha > alpha + $ echo beta > beta + $ hg addr + adding alpha + adding beta + $ hg ci -m 1 + + $ cd .. + $ hg clone test-validation test-validation-clone + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + +Test spurious filelog entries: + + $ cd test-validation-clone + $ echo blah >> beta + $ cp .hg/store/data/beta.i tmp1 + $ hg ci -m 2 + $ cp .hg/store/data/beta.i tmp2 + $ hg -q rollback + $ mv tmp2 .hg/store/data/beta.i + $ echo blah >> beta + $ hg ci -m '2 (corrupt)' + +Expected to fail: + + $ hg verify + checking changesets + checking manifests + crosschecking files in changesets and manifests + checking files + beta@1: dddc47b3ba30 not in manifests + 2 files, 2 changesets, 4 total revisions + 1 integrity errors encountered! + (first damaged changeset appears to be 1) + [1] + + $ hg push + pushing to $TESTTMP/test-validation (glob) + searching for changes + adding changesets + adding manifests + adding file changes + transaction abort! + rollback completed + abort: received spurious file revlog entry + [255] + + $ hg -q rollback + $ mv tmp1 .hg/store/data/beta.i + $ echo beta > beta + +Test missing filelog entries: + + $ cp .hg/store/data/beta.i tmp + $ echo blah >> beta + $ hg ci -m '2 (corrupt)' + $ mv tmp .hg/store/data/beta.i + +Expected to fail: + + $ hg verify + checking changesets + checking manifests + crosschecking files in changesets and manifests + checking files + beta@1: manifest refers to unknown revision dddc47b3ba30 + 2 files, 2 changesets, 2 total revisions + 1 integrity errors encountered! + (first damaged changeset appears to be 1) + [1] + + $ hg push + pushing to