##// END OF EJS Templates
fsmonitor: refresh pywatchman with upstream...
fsmonitor: refresh pywatchman with upstream This commit vendors pywatchman commit 259dc66dc9591f9b7ce76d0275bb1065f390c9b1 from upstream without modifications. The previously vendored pywatchman from changeset 16f4b341288d was from Git commit c77452. This commit effectively undoes the following Mercurial changesets: * dd35abc409ee fsmonitor: correct an error message * b1f62cd39b5c fsmonitor: layer on another hack in bser.c for os.stat() compat (issue5811) * c31ce080eb75 py3: convert arguments, cwd and env to native strings when spawning subprocess * 876494fd967d cleanup: delete lots of unused local variables * 57264906a996 watchman: add the possibility to set the exact watchman binary location The newly-vendored code has support for specifying the binary location, so 57264906a996 does not need applied. But we do need to modify our code to specify a proper argument name. 876494fd967d is not important, so it will be ignored. c31ce080eb75 globally changed the code base to always pass str to subprocess. But pywatchman's code is Python 3 clean, so we don't need to do this. This leaves dd35abc409ee and b1f62cd39b5c, which will be re-applied in subsequent commits. Differential Revision: https://phab.mercurial-scm.org/D7201

File last commit:

r43347:687b865b default
r43703:6469c23a stable
Show More
narrowtemplates.py
52 lines | 1.5 KiB | text/x-python | PythonLexer
/ hgext / narrow / narrowtemplates.py
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 # narrowtemplates.py - added template keywords for narrow clones
#
# Copyright 2017 Google, Inc.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from __future__ import absolute_import
from mercurial import (
Augie Fackler
narrowtemplates: update to use registrar mechanism...
r36108 registrar,
Augie Fackler
narrow: move from ELLIPSIS_NODE_FLAG to revlog.REVIDX_ELLIPSIS...
r36107 revlog,
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 )
Augie Fackler
narrowtemplates: update to use registrar mechanism...
r36108 keywords = {}
templatekeyword = registrar.templatekeyword(keywords)
revsetpredicate = registrar.revsetpredicate()
Augie Fackler
formatting: blacken the codebase...
r43346
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 def _isellipsis(repo, rev):
Augie Fackler
narrow: move from ELLIPSIS_NODE_FLAG to revlog.REVIDX_ELLIPSIS...
r36107 if repo.changelog.flags(rev) & revlog.REVIDX_ELLIPSIS:
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 return True
return False
Augie Fackler
formatting: blacken the codebase...
r43346
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 @templatekeyword(b'ellipsis', requires={b'repo', b'ctx'})
Yuya Nishihara
templatekw: switch non-showlist template keywords to new API
r36531 def ellipsis(context, mapping):
Yuya Nishihara
narrow: drop redundant templatekw/revset names from help text...
r36457 """String. 'ellipsis' if the change is an ellipsis node, else ''."""
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 repo = context.resource(mapping, b'repo')
ctx = context.resource(mapping, b'ctx')
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 if _isellipsis(repo, ctx.rev()):
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 return b'ellipsis'
return b''
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096
Augie Fackler
formatting: blacken the codebase...
r43346
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 @templatekeyword(b'outsidenarrow', requires={b'repo', b'ctx'})
Yuya Nishihara
templatekw: switch non-showlist template keywords to new API
r36531 def outsidenarrow(context, mapping):
Yuya Nishihara
narrow: drop redundant templatekw/revset names from help text...
r36457 """String. 'outsidenarrow' if the change affects no tracked files,
else ''."""
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 repo = context.resource(mapping, b'repo')
ctx = context.resource(mapping, b'ctx')
Martin von Zweigbergk
narrow: drop safehasattr() checks for always-present repo.narrowmatch...
r36490 m = repo.narrowmatch()
Danny Hooper
narrow: consider empty commits to be "inside the narrow spec" for templates...
r42550 if ctx.files() and not m.always():
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 if not any(m(f) for f in ctx.files()):
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 return b'outsidenarrow'
return b''
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096
Augie Fackler
formatting: blacken the codebase...
r43346
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 @revsetpredicate(b'ellipsis()')
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 def ellipsisrevset(repo, subset, x):
Yuya Nishihara
narrow: drop redundant templatekw/revset names from help text...
r36457 """Changesets that are ellipsis nodes."""
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 return subset.filter(lambda r: _isellipsis(repo, r))