D2934: forget: add --confirm option
khanchi97 added a comment. I have made the requested changes. Now --confirm will prompt per file and also added all/skip option which will either include all the remaining files or skip all the remaining files according the user input. INLINE COMMENTS > av6 wrote in cmdutil.py:2007 > "cannot specify both --dry-run and --confirm" is the style used in other > commands. sorry, am I supposed to make any change here? > pulkit wrote in cmdutil.py:2047 > I think the right behavior should be to ask for each file and forget the ones > which user confirmed to forget. cool :) > av6 wrote in commands.py:2043 > Looks like test-completion.t also needs to be updated. yeah, I will update this. > test-add.t:302 > + removing foo > + are you sure you want to forget (yn)? y > + $ cd .. I need some help here. Why it's not passing `n` as a response? I passed `n` in line 299 but as a response from user why it is taking `y` everytime? > pulkit wrote in test-add.t:302 > Looks like it's not reading the input. Look whether ui.interactive is set or > not. I have set ui.interactive=True but, the problem is still same. And also by default ui.interactive is always True. > test-add.t:296 > + > EOF > + forget foo (yn)? y > + removing foo I have set ui.interactive=True but it still not read input. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2934 To: khanchi97, #hg-reviewers, av6, pulkit Cc: mharbison72, yuja, pulkit, av6, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 2] lfs: avoid an improper usage of os.path.basename() to parse a URI
# HG changeset patch # User Matt Harbison# Date 1522554476 14400 # Sat Mar 31 23:47:56 2018 -0400 # Node ID bdef5a344ebfd54cf454b184e14d0c37400f7547 # Parent 2ed180117f7658d0cbf6a1ece20944465c55c947 lfs: avoid an improper usage of os.path.basename() to parse a URI diff --git a/hgext/lfs/wireprotolfsserver.py b/hgext/lfs/wireprotolfsserver.py --- a/hgext/lfs/wireprotolfsserver.py +++ b/hgext/lfs/wireprotolfsserver.py @@ -10,7 +10,6 @@ from __future__ import absolute_import import datetime import errno import json -import os from mercurial.hgweb import ( common as hgwebcommon, @@ -239,7 +238,7 @@ def _processbasictransfer(repo, req, res """ method = req.method -oid = os.path.basename(req.dispatchpath) +oid = req.dispatchparts[-1] localstore = repo.svfs.lfslocalblobstore if method == b'PUT': ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 2] lfs: ensure the transfer request is for a known URI
# HG changeset patch # User Matt Harbison# Date 1522555088 14400 # Sat Mar 31 23:58:08 2018 -0400 # Node ID 61133b211f50194afc52f576d93c58d3f5f6c529 # Parent bdef5a344ebfd54cf454b184e14d0c37400f7547 lfs: ensure the transfer request is for a known URI Since the dispatching code only checks the beginning of the string, this enforces that there's only one more path component. diff --git a/hgext/lfs/wireprotolfsserver.py b/hgext/lfs/wireprotolfsserver.py --- a/hgext/lfs/wireprotolfsserver.py +++ b/hgext/lfs/wireprotolfsserver.py @@ -22,6 +22,7 @@ from mercurial import ( HTTP_OK = hgwebcommon.HTTP_OK HTTP_CREATED = hgwebcommon.HTTP_CREATED HTTP_BAD_REQUEST = hgwebcommon.HTTP_BAD_REQUEST +HTTP_NOT_FOUND = hgwebcommon.HTTP_NOT_FOUND def handlewsgirequest(orig, rctx, req, res, checkperm): """Wrap wireprotoserver.handlewsgirequest() to possibly process an LFS @@ -241,6 +242,10 @@ def _processbasictransfer(repo, req, res oid = req.dispatchparts[-1] localstore = repo.svfs.lfslocalblobstore +if len(req.dispatchparts) != 4: +_sethttperror(res, HTTP_NOT_FOUND) +return True + if method == b'PUT': checkperm('upload') ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH V2] lfs: add an experimental knob to disable blob serving
# HG changeset patch # User Matt Harbison# Date 1522524043 14400 # Sat Mar 31 15:20:43 2018 -0400 # Node ID 6d38647fb53d4f8b5a874105befd9994d1a9f2f5 # Parent 40f0b221aee73bca2072812062d0f112a134bedf lfs: add an experimental knob to disable blob serving The use case here is the server admin may want to store the blobs elsewhere. As it stands now, the `lfs.url` config on the client side is all that enforces this (the web.allow-* permissions aren't able to block LFS blobs without also blocking normal hg traffic). The real solution to this is to implement the 'verify' action on the client and server, but that's not a near term goal. Whether this is useful in its own right, and should be promoted out of experimental at some point is TBD. Since the other two tests that deal with LFS and `hg serve` are already complex and have #testcases, this seems like a good time to start a new test dedicated to access checks against the server. Instead of conditionally wrapping the wire protocol handler, I put this in the handler because I'd still like to bring the annotations in from the evolve extension in order to set up the wrapping. The 400 status probably isn't great, but that's what it would be for existing `hg serve` instances without support for serving blobs. diff --git a/hgext/lfs/__init__.py b/hgext/lfs/__init__.py --- a/hgext/lfs/__init__.py +++ b/hgext/lfs/__init__.py @@ -166,6 +166,9 @@ testedwith = 'ships-with-hg-core' configtable = {} configitem = registrar.configitem(configtable) +configitem('experimental', 'lfs.serve', +default=True, +) configitem('experimental', 'lfs.user-agent', default=None, ) diff --git a/hgext/lfs/wireprotolfsserver.py b/hgext/lfs/wireprotolfsserver.py --- a/hgext/lfs/wireprotolfsserver.py +++ b/hgext/lfs/wireprotolfsserver.py @@ -31,6 +31,9 @@ def handlewsgirequest(orig, rctx, req, r if orig(rctx, req, res, checkperm): return True +if not rctx.repo.ui.configbool('experimental', 'lfs.serve'): +return False + if not req.dispatchpath: return False diff --git a/tests/test-lfs-serve-access.t b/tests/test-lfs-serve-access.t new file mode 100644 --- /dev/null +++ b/tests/test-lfs-serve-access.t @@ -0,0 +1,67 @@ +#require serve + + $ cat >> $HGRCPATH < [extensions] + > lfs= + > [lfs] + > url=http://localhost:$HGPORT/.git/info/lfs + > track=all() + > [web] + > push_ssl = False + > allow-push = * + > EOF + +Serving LFS files can experimentally be turned off. The long term solution is +to support the 'verify' action in both client and server, so that the server can +tell the client to store files elsewhere. + + $ hg init server + $ hg --config "lfs.usercache=$TESTTMP/servercache" \ + >--config experimental.lfs.serve=False -R server serve -d \ + >-p $HGPORT --pid-file=hg.pid -A $TESTTMP/access.log -E $TESTTMP/errors.log + $ cat hg.pid >> $DAEMON_PIDS + +Uploads fail... + + $ hg init client + $ echo 'this-is-an-lfs-file' > client/lfs.bin + $ hg -R client ci -Am 'initial commit' + adding lfs.bin + $ hg -R client push http://localhost:$HGPORT + pushing to http://localhost:$HGPORT/ + searching for changes + abort: LFS HTTP error: HTTP Error 400: no such method: .git (action=upload)! + [255] + +... so do a local push to make the data available. Remove the blob from the +default cache, so it attempts to download. + $ hg --config "lfs.usercache=$TESTTMP/servercache" \ + >--config "lfs.url=null://" \ + >-R client push -q server + $ rm -rf `hg config lfs.usercache` + +Downloads fail... + + $ hg clone http://localhost:$HGPORT httpclone + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + new changesets 525251863cad + updating to branch default + abort: LFS HTTP error: HTTP Error 400: no such method: .git (action=download)! + [255] + + $ $PYTHON $RUNTESTDIR/killdaemons.py $DAEMON_PIDS + + $ cat $TESTTMP/access.log $TESTTMP/errors.log + $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) + $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D525251863cad618e55d483555f3d00a2ca99597e x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) + $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) + $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) + $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 400 - (glob) + $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) + $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) + $LOCALIP - - [$LOGDATE$] "GET /?cmd=getbundle HTTP/1.1" 200 -
[PATCH 5 of 8] templater: drop unneeded generator from mappable object
# HG changeset patch # User Yuya Nishihara# Date 1521287908 -32400 # Sat Mar 17 20:58:28 2018 +0900 # Node ID cc616e233d253af1aeb4cc2576a38a437c3be95a # Parent 9a9b1047830a742e914d7085cfd9df34f5577d64 templater: drop unneeded generator from mappable object Per the definition of the show() interface, it can return a bytes. diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py --- a/mercurial/templateutil.py +++ b/mercurial/templateutil.py @@ -108,15 +108,11 @@ class mappable(wrapped): """ def __init__(self, gen, key, value, makemap): -if gen is not None: -self._gen = gen # generator or function returning generator +self._gen = gen # generator or function returning generator self._key = key self._value = value # may be generator of strings self._makemap = makemap -def _gen(self): -yield pycompat.bytestr(self._value) - def tomap(self): return self._makemap(self._key) @@ -126,6 +122,8 @@ class mappable(wrapped): def show(self, context): # TODO: switch gen to context-based API? gen = self._gen +if gen is None: +return pycompat.bytestr(self._value) if callable(gen): return gen() return gen ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 8] templater: pass context down to unwraphybrid()
# HG changeset patch # User Yuya Nishihara# Date 1521284945 -32400 # Sat Mar 17 20:09:05 2018 +0900 # Node ID 529838f7858556c0f9d180a276b483578c6d55d4 # Parent 02079695afdd39020b13f238c69691dce14b932f templater: pass context down to unwraphybrid() See the subsequent patches for why. Unlike eval*() functions, flatten(), stringify(), and unwraphybrid() don't take a mapping since these functions may be applied to a tree of generators where each node should be bound to the mapping when it was evaluated. diff --git a/mercurial/templatefuncs.py b/mercurial/templatefuncs.py --- a/mercurial/templatefuncs.py +++ b/mercurial/templatefuncs.py @@ -283,7 +283,7 @@ def ifcontains(context, mapping, args): keytype = getattr(haystack, 'keytype', None) try: needle = evalrawexp(context, mapping, args[0]) -needle = templateutil.unwrapastype(needle, keytype or bytes) +needle = templateutil.unwrapastype(context, needle, keytype or bytes) found = (needle in haystack) except error.ParseError: found = False diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -679,7 +679,7 @@ class engine(object): if extramapping: extramapping.update(mapping) mapping = extramapping -return templateutil.flatten(func(self, mapping, data)) +return templateutil.flatten(self, func(self, mapping, data)) engines = {'default': engine} diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py --- a/mercurial/templateutil.py +++ b/mercurial/templateutil.py @@ -120,7 +120,7 @@ def hybridlist(data, name, fmt=None, gen prefmt = pycompat.bytestr return hybrid(gen, data, lambda x: {name: x}, lambda x: fmt % prefmt(x)) -def unwraphybrid(thing): +def unwraphybrid(context, thing): """Return an object which can be stringified possibly by using a legacy template""" gen = getattr(thing, 'gen', None) @@ -241,9 +241,9 @@ def _showcompatlist(context, mapping, na if context.preload(endname): yield context.process(endname, mapping) -def flatten(thing): +def flatten(context, thing): """Yield a single stream from a possibly nested set of iterators""" -thing = unwraphybrid(thing) +thing = unwraphybrid(context, thing) if isinstance(thing, bytes): yield thing elif isinstance(thing, str): @@ -257,7 +257,7 @@ def flatten(thing): yield pycompat.bytestr(thing) else: for i in thing: -i = unwraphybrid(i) +i = unwraphybrid(context, i) if isinstance(i, bytes): yield i elif i is None: @@ -265,14 +265,14 @@ def flatten(thing): elif not util.safehasattr(i, '__iter__'): yield pycompat.bytestr(i) else: -for j in flatten(i): +for j in flatten(context, i): yield j -def stringify(thing): +def stringify(context, thing): """Turn values into bytes by converting into text and concatenating them""" if isinstance(thing, bytes): return thing # retain localstr to be round-tripped -return b''.join(flatten(thing)) +return b''.join(flatten(context, thing)) def findsymbolicname(arg): """Find symbolic name for the given compiled expression; returns None @@ -294,17 +294,17 @@ def evalrawexp(context, mapping, arg): def evalfuncarg(context, mapping, arg): """Evaluate given argument as value type""" -return _unwrapvalue(evalrawexp(context, mapping, arg)) +return _unwrapvalue(context, evalrawexp(context, mapping, arg)) # TODO: unify this with unwrapvalue() once the bug of templatefunc.join() # is fixed. we can't do that right now because join() has to take a generator # of byte strings as it is, not a lazy byte string. -def _unwrapvalue(thing): +def _unwrapvalue(context, thing): thing = unwrapvalue(thing) # evalrawexp() may return string, generator of strings or arbitrary object # such as date tuple, but filter does not want generator. if isinstance(thing, types.GeneratorType): -thing = stringify(thing) +thing = stringify(context, thing) return thing def evalboolean(context, mapping, arg): @@ -322,15 +322,15 @@ def evalboolean(context, mapping, arg): return thing # other objects are evaluated as strings, which means 0 is True, but # empty dict/list should be False as they are expected to be '' -return bool(stringify(thing)) +return bool(stringify(context, thing)) def evaldate(context, mapping, arg, err=None): """Evaluate given argument as a date tuple or a date string; returns a (unixtime, offset) tuple""" -return unwrapdate(evalrawexp(context, mapping, arg), err) +return unwrapdate(context, evalrawexp(context, mapping, arg), err) -def unwrapdate(thing, err=None): -thing =
[PATCH 7 of 8] templater: extract private function to evaluate generator to byte string
# HG changeset patch # User Yuya Nishihara# Date 1521808816 -32400 # Fri Mar 23 21:40:16 2018 +0900 # Node ID 5d5ecd0c1e91676bc1ac6a481679cad21fb0e108 # Parent d7a44391a574f6526d4d14925abe1dce048a83e3 templater: extract private function to evaluate generator to byte string diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py --- a/mercurial/templateutil.py +++ b/mercurial/templateutil.py @@ -308,6 +308,12 @@ def findsymbolicname(arg): else: return None +def _unthunk(context, thing): +"""Evaluate a lazy byte string into value""" +if not isinstance(thing, types.GeneratorType): +return thing +return stringify(context, thing) + def evalrawexp(context, mapping, arg): """Evaluate given argument as a bare template object which may require further processing (such as folding generator of strings)""" @@ -325,9 +331,7 @@ def _unwrapvalue(context, thing): thing = unwrapvalue(context, thing) # evalrawexp() may return string, generator of strings or arbitrary object # such as date tuple, but filter does not want generator. -if isinstance(thing, types.GeneratorType): -thing = stringify(context, thing) -return thing +return _unthunk(context, thing) def evalboolean(context, mapping, arg): """Evaluate given argument as boolean, but also takes boolean literals""" ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 6 of 8] templater: pass context down to unwrapvalue()
# HG changeset patch # User Yuya Nishihara# Date 1521382461 -32400 # Sun Mar 18 23:14:21 2018 +0900 # Node ID d7a44391a574f6526d4d14925abe1dce048a83e3 # Parent cc616e233d253af1aeb4cc2576a38a437c3be95a templater: pass context down to unwrapvalue() The same reason as why I made unwraphybrid() take a context. diff --git a/mercurial/templatefuncs.py b/mercurial/templatefuncs.py --- a/mercurial/templatefuncs.py +++ b/mercurial/templatefuncs.py @@ -318,7 +318,7 @@ def join(context, mapping, args): # TODO: perhaps this should be evalfuncarg(), but it can't because hgweb # abuses generator as a keyword that returns a list of dicts. joinset = evalrawexp(context, mapping, args[0]) -joinset = templateutil.unwrapvalue(joinset) +joinset = templateutil.unwrapvalue(context, joinset) joinfmt = getattr(joinset, 'joinfmt', pycompat.identity) joiner = " " if len(args) > 1: diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py --- a/mercurial/templateutil.py +++ b/mercurial/templateutil.py @@ -152,7 +152,7 @@ def unwraphybrid(context, thing): return thing return thing.show(context) -def unwrapvalue(thing): +def unwrapvalue(context, thing): """Move the inner value object out of the wrapper""" if not util.safehasattr(thing, '_value'): return thing @@ -322,7 +322,7 @@ def evalfuncarg(context, mapping, arg): # is fixed. we can't do that right now because join() has to take a generator # of byte strings as it is, not a lazy byte string. def _unwrapvalue(context, thing): -thing = unwrapvalue(thing) +thing = unwrapvalue(context, thing) # evalrawexp() may return string, generator of strings or arbitrary object # such as date tuple, but filter does not want generator. if isinstance(thing, types.GeneratorType): @@ -339,7 +339,7 @@ def evalboolean(context, mapping, arg): thing = stringutil.parsebool(data) else: thing = func(context, mapping, data) -thing = unwrapvalue(thing) +thing = unwrapvalue(context, thing) if isinstance(thing, bool): return thing # other objects are evaluated as strings, which means 0 is True, but ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 4 of 8] templater: mark .gen as a private attribute
# HG changeset patch # User Yuya Nishihara# Date 1521287802 -32400 # Sat Mar 17 20:56:42 2018 +0900 # Node ID 9a9b1047830a742e914d7085cfd9df34f5577d64 # Parent c8be87f32f1cdf473685b8302300265d57f3b512 templater: mark .gen as a private attribute diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py --- a/mercurial/templateutil.py +++ b/mercurial/templateutil.py @@ -56,12 +56,13 @@ class hybrid(wrapped): def __init__(self, gen, values, makemap, joinfmt, keytype=None): if gen is not None: -self.gen = gen # generator or function returning generator +self._gen = gen # generator or function returning generator self._values = values self._makemap = makemap self.joinfmt = joinfmt self.keytype = keytype # hint for 'x in y' where type(x) is unresolved -def gen(self): + +def _gen(self): """Default generator to stringify this as {join(self, ' ')}""" for i, x in enumerate(self._values): if i > 0: @@ -74,7 +75,7 @@ class hybrid(wrapped): def show(self, context): # TODO: switch gen to context-based API? -gen = self.gen +gen = self._gen if callable(gen): return gen() return gen @@ -108,12 +109,12 @@ class mappable(wrapped): def __init__(self, gen, key, value, makemap): if gen is not None: -self.gen = gen # generator or function returning generator +self._gen = gen # generator or function returning generator self._key = key self._value = value # may be generator of strings self._makemap = makemap -def gen(self): +def _gen(self): yield pycompat.bytestr(self._value) def tomap(self): @@ -124,7 +125,7 @@ class mappable(wrapped): def show(self, context): # TODO: switch gen to context-based API? -gen = self.gen +gen = self._gen if callable(gen): return gen() return gen ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 8] templatekw: do not directly call .gen
# HG changeset patch # User Yuya Nishihara# Date 1521299496 -32400 # Sun Mar 18 00:11:36 2018 +0900 # Node ID c8be87f32f1cdf473685b8302300265d57f3b512 # Parent a26aace92f3a4e7e0acfa8d0e61ad11ec182902c templatekw: do not directly call .gen diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py --- a/mercurial/templatekw.py +++ b/mercurial/templatekw.py @@ -613,10 +613,7 @@ def showsuccessorssets(context, mapping) # Format the successorssets def render(d): -t = [] -for i in d.gen(): -t.append(i) -return "".join(t) +return templateutil.stringify(context, d.show(context)) def gen(data): yield "; ".join(render(d) for d in data) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 8 of 8] templater: define interface for objects requiring unwrapvalue()
# HG changeset patch # User Yuya Nishihara# Date 1521288196 -32400 # Sat Mar 17 21:03:16 2018 +0900 # Node ID 7e5b902521dc5d58b3da8f6bd8b4b8e8cb33dad7 # Parent 5d5ecd0c1e91676bc1ac6a481679cad21fb0e108 templater: define interface for objects requiring unwrapvalue() unwrapvalue() is changed to not return a lazy bytes generator for "wrapped" types because I want to define the tovalue() interface as such. It's a baby step to unify unwrapvalue() and _unwrapvalue(). diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py --- a/mercurial/templateutil.py +++ b/mercurial/templateutil.py @@ -29,7 +29,11 @@ class TemplateNotFound(error.Abort): class wrapped(object): """Object requiring extra conversion prior to displaying or processing -as value""" +as value + +Use unwrapvalue(), unwrapastype(), or unwraphybrid() to obtain the inner +object. +""" __metaclass__ = abc.ABCMeta @@ -37,6 +41,13 @@ class wrapped(object): def show(self, context): """Return a bytes or (possibly nested) generator of bytes""" +@abc.abstractmethod +def tovalue(self, context): +"""Move the inner value object out or create a value representation + +A returned value must be serializable by templaterfilters.json(). +""" + # stub for representing a date type; may be a real date type that can # provide a readable string value class date(object): @@ -80,6 +91,10 @@ class hybrid(wrapped): return gen() return gen +def tovalue(self, context): +# TODO: return self._values and get rid of proxy methods +return self + def __contains__(self, x): return x in self._values def __getitem__(self, key): @@ -103,8 +118,7 @@ class mappable(wrapped): - "{manifest.rev}" Unlike a hybrid, this does not simulate the behavior of the underling -value. Use unwrapvalue(), unwrapastype(), or unwraphybrid() to obtain -the inner object. +value. """ def __init__(self, gen, key, value, makemap): @@ -128,6 +142,9 @@ class mappable(wrapped): return gen() return gen +def tovalue(self, context): +return _unthunk(context, self._value) + def hybriddict(data, key='key', value='value', fmt=None, gen=None): """Wrap data to support both dict-like and string-like operations""" prefmt = pycompat.identity @@ -154,9 +171,9 @@ def unwraphybrid(context, thing): def unwrapvalue(context, thing): """Move the inner value object out of the wrapper""" -if not util.safehasattr(thing, '_value'): +if not isinstance(thing, wrapped): return thing -return thing._value +return thing.tovalue(context) def wraphybridvalue(container, key, value): """Wrap an element of hybrid container to be mappable ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 8] templater: define interface for objects requiring unwraphybrid()
# HG changeset patch # User Yuya Nishihara# Date 1521287570 -32400 # Sat Mar 17 20:52:50 2018 +0900 # Node ID a26aace92f3a4e7e0acfa8d0e61ad11ec182902c # Parent 529838f7858556c0f9d180a276b483578c6d55d4 templater: define interface for objects requiring unwraphybrid() Prepares for introducing another hybrid-like data type. show() takes context as an argument so a wrapper class may render its items by pre-configured template: def show(self, context): return (context.expand(self._tmpl, m) for m in self._mappings) diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py --- a/mercurial/templateutil.py +++ b/mercurial/templateutil.py @@ -7,6 +7,7 @@ from __future__ import absolute_import +import abc import types from .i18n import _ @@ -26,12 +27,22 @@ class ResourceUnavailable(error.Abort): class TemplateNotFound(error.Abort): pass +class wrapped(object): +"""Object requiring extra conversion prior to displaying or processing +as value""" + +__metaclass__ = abc.ABCMeta + +@abc.abstractmethod +def show(self, context): +"""Return a bytes or (possibly nested) generator of bytes""" + # stub for representing a date type; may be a real date type that can # provide a readable string value class date(object): pass -class hybrid(object): +class hybrid(wrapped): """Wrapper for list or dict to support legacy template This class allows us to handle both: @@ -60,6 +71,14 @@ class hybrid(object): makemap = self._makemap for x in self._values: yield makemap(x) + +def show(self, context): +# TODO: switch gen to context-based API? +gen = self.gen +if callable(gen): +return gen() +return gen + def __contains__(self, x): return x in self._values def __getitem__(self, key): @@ -74,7 +93,7 @@ class hybrid(object): raise AttributeError(name) return getattr(self._values, name) -class mappable(object): +class mappable(wrapped): """Wrapper for non-list/dict object to support map operation This class allows us to handle both: @@ -103,6 +122,13 @@ class mappable(object): def itermaps(self): yield self.tomap() +def show(self, context): +# TODO: switch gen to context-based API? +gen = self.gen +if callable(gen): +return gen() +return gen + def hybriddict(data, key='key', value='value', fmt=None, gen=None): """Wrap data to support both dict-like and string-like operations""" prefmt = pycompat.identity @@ -123,12 +149,9 @@ def hybridlist(data, name, fmt=None, gen def unwraphybrid(context, thing): """Return an object which can be stringified possibly by using a legacy template""" -gen = getattr(thing, 'gen', None) -if gen is None: +if not isinstance(thing, wrapped): return thing -if callable(gen): -return gen() -return gen +return thing.show(context) def unwrapvalue(thing): """Move the inner value object out of the wrapper""" ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] templatefuncs: do not crash because of invalid value fed to mailmap()
# HG changeset patch # User Yuya Nishihara# Date 1522548389 -32400 # Sun Apr 01 11:06:29 2018 +0900 # Node ID 02079695afdd39020b13f238c69691dce14b932f # Parent 2ed180117f7658d0cbf6a1ece20944465c55c947 templatefuncs: do not crash because of invalid value fed to mailmap() diff --git a/mercurial/templatefuncs.py b/mercurial/templatefuncs.py --- a/mercurial/templatefuncs.py +++ b/mercurial/templatefuncs.py @@ -175,7 +175,7 @@ def mailmap(context, mapping, args): if len(args) != 1: raise error.ParseError(_("mailmap expects one argument")) -author = evalfuncarg(context, mapping, args[0]) +author = evalstring(context, mapping, args[0]) cache = context.resource(mapping, 'cache') repo = context.resource(mapping, 'repo') diff --git a/tests/test-mailmap.t b/tests/test-mailmap.t --- a/tests/test-mailmap.t +++ b/tests/test-mailmap.t @@ -65,3 +65,8 @@ A commit with improperly formatted user Proper Name 4 Testuser Improper user + +No TypeError beacause of invalid input + + $ hg log -T '{mailmap(termwidth)}\n' -r0 + 80 ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3001: templatefuncs: remove redundant "or author" from mailmap return statement
This revision was automatically updated to reflect the committed changes. Closed by commit rHG3685a79ea51b: templatefuncs: remove redundant or author from mailmap return statement (authored by sheehan, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3001?vs=7477=7481 REVISION DETAIL https://phab.mercurial-scm.org/D3001 AFFECTED FILES mercurial/templatefuncs.py CHANGE DETAILS diff --git a/mercurial/templatefuncs.py b/mercurial/templatefuncs.py --- a/mercurial/templatefuncs.py +++ b/mercurial/templatefuncs.py @@ -184,7 +184,7 @@ data = repo.wvfs.tryread('.mailmap') cache['mailmap'] = stringutil.parsemailmap(data) -return stringutil.mapname(cache['mailmap'], author) or author +return stringutil.mapname(cache['mailmap'], author) @templatefunc('pad(text, width[, fillchar=\' \'[, left=False]])', argspec='text width fillchar left') To: sheehan, #hg-reviewers, yuja Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3002: stringutil: rename local email/names variables to their plural forms
This revision was automatically updated to reflect the committed changes. Closed by commit rHG54b896f195d1: stringutil: rename local email/names variables to their plural forms (authored by sheehan, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D3002?vs=7478=7482#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3002?vs=7478=7482 REVISION DETAIL https://phab.mercurial-scm.org/D3002 AFFECTED FILES mercurial/utils/stringutil.py CHANGE DETAILS diff --git a/mercurial/utils/stringutil.py b/mercurial/utils/stringutil.py --- a/mercurial/utils/stringutil.py +++ b/mercurial/utils/stringutil.py @@ -202,9 +202,9 @@ if line.lstrip().startswith('#') or any(c not in line for c in '<>@'): continue -# name, email hold the parsed emails and names for each line +# names, emails hold the parsed emails and names for each line # name_builder holds the words in a persons name -name, email = [], [] +names, emails = [], [] namebuilder = [] for element in line.split(): @@ -215,29 +215,29 @@ elif element.startswith('<') and element.endswith('>'): # We have found an email. # Parse it, and finalize any names from earlier -email.append(element[1:-1]) # Slice off the "<>" +emails.append(element[1:-1]) # Slice off the "<>" if namebuilder: -name.append(' '.join(namebuilder)) +names.append(' '.join(namebuilder)) namebuilder = [] # Break if we have found a second email, any other # data does not fit the spec for .mailmap -if len(email) > 1: +if len(emails) > 1: break else: # We have found another word in the committers name namebuilder.append(element) mailmapkey = mailmapping( -email=email[-1], -name=name[-1] if len(name) == 2 else None, +email=emails[-1], +name=names[-1] if len(names) == 2 else None, ) mailmap[mailmapkey] = mailmapping( -email=email[0], -name=name[0] if name else None, +email=emails[0], +name=names[0] if names else None, ) return mailmap To: sheehan, #hg-reviewers, yuja Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3004: stringutil: edit comment to reflect actual data type name
This revision was automatically updated to reflect the committed changes. Closed by commit rHG2ed180117f76: stringutil: edit comment to reflect actual data type name (authored by sheehan, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3004?vs=7480=7483 REVISION DETAIL https://phab.mercurial-scm.org/D3004 AFFECTED FILES mercurial/utils/stringutil.py CHANGE DETAILS diff --git a/mercurial/utils/stringutil.py b/mercurial/utils/stringutil.py --- a/mercurial/utils/stringutil.py +++ b/mercurial/utils/stringutil.py @@ -300,7 +300,7 @@ if not isauthorwellformed(author) or not mailmap: return author -# Turn the user name into a mailmaptup +# Turn the user name into a mailmapping commit = mailmapping(name=person(author), email=email(author)) try: To: sheehan, #hg-reviewers, yuja Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3003: stringutil: improve check for failed mailmap line parsing
This revision was automatically updated to reflect the committed changes. Closed by commit rHG0e7550b0964c: stringutil: improve check for failed mailmap line parsing (authored by sheehan, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D3003?vs=7479=7484#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3003?vs=7479=7484 REVISION DETAIL https://phab.mercurial-scm.org/D3003 AFFECTED FILES mercurial/utils/stringutil.py CHANGE DETAILS diff --git a/mercurial/utils/stringutil.py b/mercurial/utils/stringutil.py --- a/mercurial/utils/stringutil.py +++ b/mercurial/utils/stringutil.py @@ -166,6 +166,30 @@ email = attr.ib() name = attr.ib(default=None) +def _ismailmaplineinvalid(names, emails): +'''Returns True if the parsed names and emails +in a mailmap entry are invalid. + +>>> # No names or emails fails +>>> names, emails = [], [] +>>> _ismailmaplineinvalid(names, emails) +True +>>> # Only one email fails +>>> emails = [b'em...@email.com'] +>>> _ismailmaplineinvalid(names, emails) +True +>>> # One email and one name passes +>>> names = [b'Test Name'] +>>> _ismailmaplineinvalid(names, emails) +False +>>> # No names but two emails passes +>>> names = [] +>>> emails = [b'pro...@email.com', b'com...@email.com'] +>>> _ismailmaplineinvalid(names, emails) +False +''' +return not emails or not names and len(emails) < 2 + def parsemailmap(mailmapcontent): """Parses data in the .mailmap format @@ -199,7 +223,7 @@ # Don't bother checking the line if it is a comment or # is an improperly formed author field -if line.lstrip().startswith('#') or any(c not in line for c in '<>@'): +if line.lstrip().startswith('#'): continue # names, emails hold the parsed emails and names for each line @@ -230,6 +254,12 @@ # We have found another word in the committers name namebuilder.append(element) +# Check to see if we have parsed the line into a valid form +# We require at least one email, and either at least one +# name or a second email +if _ismailmaplineinvalid(names, emails): +continue + mailmapkey = mailmapping( email=emails[-1], name=names[-1] if len(names) == 2 else None, To: sheehan, #hg-reviewers, yuja Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3000: addremove: remove opts from scmutil.addremove
yuja requested changes to this revision. yuja added a comment. This revision now requires changes to proceed. Sorry, I didn't notice that the opts dict carries extra options other than subrepos, dry_run, and similarity. Because of that, my idea of dropping `opts` turns out to be worse than the current state. Maybe we can get rid of `dry_run` and `similarity` instead, but we'll have to be careful since the default `similarity` value varies on command. INLINE COMMENTS > commands.py:252 > +subrepos, after = opts.get('subrepos'), opts.get('after') > +large, lfsize = opts.get('large'), opts.get('lfsize') > try: Oops, largefiles options in core. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3000 To: khanchi97, #hg-reviewers, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3003: stringutil: improve check for failed mailmap line parsing
yuja added a comment. Queued the series, thanks. INLINE COMMENTS > stringutil.py:169 > > +def ismailmaplineinvalid(names, emails): > +'''Returns True if the parsed names and emails I renamed this to `_ismailmaplineinvalid` since this will never be publicly used. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3003 To: sheehan, #hg-reviewers, yuja Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 4] lfs: improve the client message when the server signals an object error
On Sat, 31 Mar 2018 18:28:24 -0400, Matt Harbison wrote: > # HG changeset patch > # User Matt Harbison> # Date 1519620242 18000 > # Sun Feb 25 23:44:02 2018 -0500 > # Node ID 0cd7c41df75ac914d95f398105317afb53f7e5db > # Parent 97ab6f2dc3c3b0d689e90b4872b3874e649ce4e6 > lfs: improve the client message when the server signals an object error Queued 1, 2, and 4, thanks. > +msg = errors.get(code, 'status code %d' % code) > +raise LfsRemoteError(_(('LFS server error for "%s": %s')) I've removed doubled parens in flight. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 3 of 4] lfs: add an experimental knob to disable blob serving
On second thought, I can probably just not wrap the wire protocol function. But the other patches here shouldn’t depend on this. > On Mar 31, 2018, at 6:28 PM, Matt Harbisonwrote: > > # HG changeset patch > # User Matt Harbison > # Date 1522524043 14400 > # Sat Mar 31 15:20:43 2018 -0400 > # Node ID f3e750cdf0b3fb1977b7ea0f7685d2a86d3c199c > # Parent 40f0b221aee73bca2072812062d0f112a134bedf > lfs: add an experimental knob to disable blob serving > > The use case here is the server admin may want to store the blobs elsewhere. > As > it stands now, the `lfs.url` config on the client side is all that enforces > this > (the web.allow-* permissions aren't able to block LFS blobs without also > blocking normal hg traffic). The real solution to this is to implement the > 'verify' action on the client and server, but that's not a near term goal. > Whether this is useful in its own right, and should be promoted out of > experimental at some point is TBD. > > Since the other two tests that deal with LFS and `hg serve` are already > complex > and have #testcases, this seems like a good time to start a new test dedicated > to access checks against the server. I believe that accessing some random URI > (that isn't a protocol API) will 404 before the access checks, so that's what > I > did here, for simplicity. > > diff --git a/hgext/lfs/__init__.py b/hgext/lfs/__init__.py > --- a/hgext/lfs/__init__.py > +++ b/hgext/lfs/__init__.py > @@ -166,6 +166,9 @@ testedwith = 'ships-with-hg-core' > configtable = {} > configitem = registrar.configitem(configtable) > > +configitem('experimental', 'lfs.serve', > +default=True, > +) > configitem('experimental', 'lfs.user-agent', > default=None, > ) > diff --git a/hgext/lfs/wireprotolfsserver.py b/hgext/lfs/wireprotolfsserver.py > --- a/hgext/lfs/wireprotolfsserver.py > +++ b/hgext/lfs/wireprotolfsserver.py > @@ -35,12 +35,22 @@ def handlewsgirequest(orig, rctx, req, r > return False > > try: > +serve = rctx.repo.ui.configbool('experimental', 'lfs.serve') > + > if req.dispatchpath == b'.git/info/lfs/objects/batch': > +if not serve: > +res.status = hgwebcommon.statusmessage(404) > +res.setbodybytes(b'') > +return True > checkperm(rctx, req, 'pull') > return _processbatchrequest(rctx.repo, req, res) > # TODO: reserve and use a path in the proposed http wireprotocol /api/ > # namespace? > elif req.dispatchpath.startswith(b'.hg/lfs/objects'): > +if not serve: > +res.status = hgwebcommon.statusmessage(404) > +res.setbodybytes(b'') > +return True > return _processbasictransfer(rctx.repo, req, res, > lambda perm: > checkperm(rctx, req, perm)) > diff --git a/tests/test-lfs-serve-access.t b/tests/test-lfs-serve-access.t > new file mode 100644 > --- /dev/null > +++ b/tests/test-lfs-serve-access.t > @@ -0,0 +1,67 @@ > +#require serve > + > + $ cat >> $HGRCPATH < + > [extensions] > + > lfs= > + > [lfs] > + > url=http://localhost:$HGPORT/.git/info/lfs > + > track=all() > + > [web] > + > push_ssl = False > + > allow-push = * > + > EOF > + > +Serving LFS files can experimentally be turned off. The long term solution > is > +to support the 'verify' action in both client and server, so that the server > can > +tell the client to store files elsewhere. > + > + $ hg init server > + $ hg --config "lfs.usercache=$TESTTMP/servercache" \ > + >--config experimental.lfs.serve=False -R server serve -d \ > + >-p $HGPORT --pid-file=hg.pid -A $TESTTMP/access.log -E > $TESTTMP/errors.log > + $ cat hg.pid >> $DAEMON_PIDS > + > +Uploads fail... > + > + $ hg init client > + $ echo 'this-is-an-lfs-file' > client/lfs.bin > + $ hg -R client ci -Am 'initial commit' > + adding lfs.bin > + $ hg -R client push http://localhost:$HGPORT > + pushing to http://localhost:$HGPORT/ > + searching for changes > + abort: LFS HTTP error: HTTP Error 404: Not Found (action=upload)! > + [255] > + > +... so do a local push to make the data available. Remove the blob from the > +default cache, so it attempts to download. > + $ hg --config "lfs.usercache=$TESTTMP/servercache" \ > + >--config "lfs.url=null://" \ > + >-R client push -q server > + $ rm -rf `hg config lfs.usercache` > + > +Downloads fail... > + > + $ hg clone http://localhost:$HGPORT httpclone > + requesting all changes > + adding changesets > + adding manifests > + adding file changes > + added 1 changesets with 1 changes to 1 files > + new changesets 525251863cad > + updating to branch default > + abort: LFS HTTP error: HTTP Error 404: Not Found (action=download)! > + [255] > + > + $ $PYTHON $RUNTESTDIR/killdaemons.py $DAEMON_PIDS > + > +
[PATCH 2 of 4] lfs: add the 'Content-Type' header called out in the file transfer spec
# HG changeset patch # User Matt Harbison# Date 1519520219 18000 # Sat Feb 24 19:56:59 2018 -0500 # Node ID 40f0b221aee73bca2072812062d0f112a134bedf # Parent 0cd7c41df75ac914d95f398105317afb53f7e5db lfs: add the 'Content-Type' header called out in the file transfer spec https://github.com/git-lfs/git-lfs/blob/master/docs/api/basic-transfers.md#uploads diff --git a/hgext/lfs/blobstore.py b/hgext/lfs/blobstore.py --- a/hgext/lfs/blobstore.py +++ b/hgext/lfs/blobstore.py @@ -332,6 +332,7 @@ class _gitlfsremote(object): hint=_('run hg verify')) request.data = filewithprogress(localstore.open(oid), None) request.get_method = lambda: 'PUT' +request.add_header('Content-Type', 'application/octet-stream') for k, v in headers: request.add_header(k, v) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 4 of 4] check-code: tighten the check for `ls -R`
# HG changeset patch # User Matt Harbison# Date 1522526066 14400 # Sat Mar 31 15:54:26 2018 -0400 # Node ID 0d8b5aa297053419ed4a46678462aa295803cbeb # Parent f3e750cdf0b3fb1977b7ea0f7685d2a86d3c199c check-code: tighten the check for `ls -R` Otherwise, this was flagging `... lfs.serve=False -R server ...` in the tests. diff --git a/contrib/check-code.py b/contrib/check-code.py --- a/contrib/check-code.py +++ b/contrib/check-code.py @@ -111,7 +111,7 @@ testpats = [ (r'head -c', "don't use 'head -c', use 'dd'"), (r'tail -n', "don't use the '-n' option to tail, just use '-'"), (r'sha1sum', "don't use sha1sum, use $TESTDIR/md5sum.py"), -(r'ls.*-\w*R', "don't use 'ls -R', use 'find'"), +(r'\bls\b.*-\w*R', "don't use 'ls -R', use 'find'"), (r'printf.*[^\\]\\([1-9]|0\d)', r"don't use 'printf \NNN', use Python"), (r'printf.*[^\\]\\x', "don't use printf \\x, use Python"), (r'\$\(.*\)', "don't use $(expr), use `expr`"), ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 4] lfs: add an experimental knob to disable blob serving
# HG changeset patch # User Matt Harbison# Date 1522524043 14400 # Sat Mar 31 15:20:43 2018 -0400 # Node ID f3e750cdf0b3fb1977b7ea0f7685d2a86d3c199c # Parent 40f0b221aee73bca2072812062d0f112a134bedf lfs: add an experimental knob to disable blob serving The use case here is the server admin may want to store the blobs elsewhere. As it stands now, the `lfs.url` config on the client side is all that enforces this (the web.allow-* permissions aren't able to block LFS blobs without also blocking normal hg traffic). The real solution to this is to implement the 'verify' action on the client and server, but that's not a near term goal. Whether this is useful in its own right, and should be promoted out of experimental at some point is TBD. Since the other two tests that deal with LFS and `hg serve` are already complex and have #testcases, this seems like a good time to start a new test dedicated to access checks against the server. I believe that accessing some random URI (that isn't a protocol API) will 404 before the access checks, so that's what I did here, for simplicity. diff --git a/hgext/lfs/__init__.py b/hgext/lfs/__init__.py --- a/hgext/lfs/__init__.py +++ b/hgext/lfs/__init__.py @@ -166,6 +166,9 @@ testedwith = 'ships-with-hg-core' configtable = {} configitem = registrar.configitem(configtable) +configitem('experimental', 'lfs.serve', +default=True, +) configitem('experimental', 'lfs.user-agent', default=None, ) diff --git a/hgext/lfs/wireprotolfsserver.py b/hgext/lfs/wireprotolfsserver.py --- a/hgext/lfs/wireprotolfsserver.py +++ b/hgext/lfs/wireprotolfsserver.py @@ -35,12 +35,22 @@ def handlewsgirequest(orig, rctx, req, r return False try: +serve = rctx.repo.ui.configbool('experimental', 'lfs.serve') + if req.dispatchpath == b'.git/info/lfs/objects/batch': +if not serve: +res.status = hgwebcommon.statusmessage(404) +res.setbodybytes(b'') +return True checkperm(rctx, req, 'pull') return _processbatchrequest(rctx.repo, req, res) # TODO: reserve and use a path in the proposed http wireprotocol /api/ # namespace? elif req.dispatchpath.startswith(b'.hg/lfs/objects'): +if not serve: +res.status = hgwebcommon.statusmessage(404) +res.setbodybytes(b'') +return True return _processbasictransfer(rctx.repo, req, res, lambda perm: checkperm(rctx, req, perm)) diff --git a/tests/test-lfs-serve-access.t b/tests/test-lfs-serve-access.t new file mode 100644 --- /dev/null +++ b/tests/test-lfs-serve-access.t @@ -0,0 +1,67 @@ +#require serve + + $ cat >> $HGRCPATH < [extensions] + > lfs= + > [lfs] + > url=http://localhost:$HGPORT/.git/info/lfs + > track=all() + > [web] + > push_ssl = False + > allow-push = * + > EOF + +Serving LFS files can experimentally be turned off. The long term solution is +to support the 'verify' action in both client and server, so that the server can +tell the client to store files elsewhere. + + $ hg init server + $ hg --config "lfs.usercache=$TESTTMP/servercache" \ + >--config experimental.lfs.serve=False -R server serve -d \ + >-p $HGPORT --pid-file=hg.pid -A $TESTTMP/access.log -E $TESTTMP/errors.log + $ cat hg.pid >> $DAEMON_PIDS + +Uploads fail... + + $ hg init client + $ echo 'this-is-an-lfs-file' > client/lfs.bin + $ hg -R client ci -Am 'initial commit' + adding lfs.bin + $ hg -R client push http://localhost:$HGPORT + pushing to http://localhost:$HGPORT/ + searching for changes + abort: LFS HTTP error: HTTP Error 404: Not Found (action=upload)! + [255] + +... so do a local push to make the data available. Remove the blob from the +default cache, so it attempts to download. + $ hg --config "lfs.usercache=$TESTTMP/servercache" \ + >--config "lfs.url=null://" \ + >-R client push -q server + $ rm -rf `hg config lfs.usercache` + +Downloads fail... + + $ hg clone http://localhost:$HGPORT httpclone + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + new changesets 525251863cad + updating to branch default + abort: LFS HTTP error: HTTP Error 404: Not Found (action=download)! + [255] + + $ $PYTHON $RUNTESTDIR/killdaemons.py $DAEMON_PIDS + + $ cat $TESTTMP/access.log $TESTTMP/errors.log + $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) + $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D525251863cad618e55d483555f3d00a2ca99597e x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) + $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) +
[PATCH 1 of 4] lfs: improve the client message when the server signals an object error
# HG changeset patch # User Matt Harbison# Date 1519620242 18000 # Sun Feb 25 23:44:02 2018 -0500 # Node ID 0cd7c41df75ac914d95f398105317afb53f7e5db # Parent 97ab6f2dc3c3b0d689e90b4872b3874e649ce4e6 lfs: improve the client message when the server signals an object error Two things here. First, the previous message included a snippet of JSON, which tends to be long (and in the case of lfs-test-server, has no error message). Instead, give a concise message where possible, and leave the JSON to a debug output. Second, the server can signal issues other than a missing individual file. This change shows a corrupt file, but I'm debating letting the corrupt file get downloaded, because 1) the error code doesn't really fit, and 2) having it locally makes forensics easier. Maybe need a config knob for that. diff --git a/hgext/lfs/blobstore.py b/hgext/lfs/blobstore.py --- a/hgext/lfs/blobstore.py +++ b/hgext/lfs/blobstore.py @@ -263,23 +263,34 @@ class _gitlfsremote(object): # server implementation (ex. lfs-test-server) does not set "error" # but just removes "download" from "actions". Treat that case # as the same as 404 error. -notfound = (response.get('error', {}).get('code') == 404 -or (action == 'download' -and action not in response.get('actions', []))) -if notfound: -ptrmap = {p.oid(): p for p in pointers} -p = ptrmap.get(response['oid'], None) -if p: -filename = getattr(p, 'filename', 'unknown') -raise LfsRemoteError( -_(('LFS server error. Remote object ' - 'for "%s" not found: %r')) % (filename, response)) +if 'error' not in response: +if (action == 'download' +and action not in response.get('actions', [])): +code = 404 else: -raise LfsRemoteError( -_('LFS server error. Unsolicited response for oid %s') -% response['oid']) -if 'error' in response: -raise LfsRemoteError(_('LFS server error: %r') % response) +continue +else: +# An error dict without a code doesn't make much sense, so +# treat as a server error. +code = response.get('error').get('code', 500) + +ptrmap = {p.oid(): p for p in pointers} +p = ptrmap.get(response['oid'], None) +if p: +filename = getattr(p, 'filename', 'unknown') +errors = { +404: 'The object does not exist', +410: 'The object was removed by the owner', +422: 'Validation error', +500: 'Internal server error', +} +msg = errors.get(code, 'status code %d' % code) +raise LfsRemoteError(_(('LFS server error for "%s": %s')) + % (filename, msg)) +else: +raise LfsRemoteError( +_('LFS server error. Unsolicited response for oid %s') +% response['oid']) def _extractobjects(self, response, pointers, action): """extract objects from response of the batch API diff --git a/tests/test-lfs-test-server.t b/tests/test-lfs-test-server.t --- a/tests/test-lfs-test-server.t +++ b/tests/test-lfs-test-server.t @@ -449,7 +449,7 @@ TODO: give the proper error indication f Content-Type: text/plain; charset=utf-8 (git-server !) Date: $HTTP_DATE$ (git-server !) abort: corrupt remote lfs object: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (git-server !) - abort: LFS server error. Remote object for "c" not found: *! (glob) (hg-server !) + abort: LFS server error for "c": Validation error! (hg-server !) [255] The corrupted blob is not added to the usercache or local store @@ -807,7 +807,7 @@ Check error message when the remote miss ] "transfer": "basic" (hg-server !) } - abort: LFS server error. Remote object for "b" not found:(.*)! (re) + abort: LFS server error for "b": The object does not exist! [255] Check error message when object does not exist: @@ -918,7 +918,7 @@ Check error message when object does not ] "transfer": "basic" (hg-server !) } - abort: LFS server error. Remote object for "a" not found:(.*)! (re) + abort: LFS server error for "a": The object does not exist! [255] $ $PYTHON $RUNTESTDIR/killdaemons.py $DAEMON_PIDS ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3003: stringutil: improve check for failed mailmap line parsing
sheehan created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The existing check for a bad mailmap file entry fails with inputs like b'>@<'. This commit adds a function to check if a sufficient amount of information has been parsed from a mailmap file entry. At minimum, one email must be found (assumed to be the commit email). If email is not empty and no names are found, then there must be two emails. If there are at least one email and name, the mapping is valid. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3003 AFFECTED FILES mercurial/utils/stringutil.py CHANGE DETAILS diff --git a/mercurial/utils/stringutil.py b/mercurial/utils/stringutil.py --- a/mercurial/utils/stringutil.py +++ b/mercurial/utils/stringutil.py @@ -166,6 +166,30 @@ email = attr.ib() name = attr.ib(default=None) +def ismailmaplineinvalid(names, emails): +'''Returns True if the parsed names and emails +in a mailmap entry are invalid. + +>>> # No names or emails fails +>>> names, emails = [], [] +>>> ismailmaplineinvalid(names, emails) +True +>>> # Only one email fails +>>> emails = [b'em...@email.com'] +>>> ismailmaplineinvalid(names, emails) +True +>>> # One email and one name passes +>>> names = [b'Test Name'] +>>> ismailmaplineinvalid(names, emails) +False +>>> # No names but two emails passes +>>> names = [] +>>> emails = [b'pro...@email.com', b'com...@email.com'] +>>> ismailmaplineinvalid(names, emails) +False +''' +return not emails or not names and len(emails) < 2 + def parsemailmap(mailmapcontent): """Parses data in the .mailmap format @@ -199,7 +223,7 @@ # Don't bother checking the line if it is a comment or # is an improperly formed author field -if line.lstrip().startswith('#') or any(c not in line for c in '<>@'): +if line.lstrip().startswith('#'): continue # name, email hold the parsed emails and names for each line @@ -230,6 +254,12 @@ # We have found another word in the committers name namebuilder.append(element) +# Check to see if we have parsed the line into a valid form +# We require at least one email, and either at least one +# name or a second email +if ismailmaplineinvalid(names, emails): +continue + mailmapkey = mailmapping( email=emails[-1], name=names[-1] if len(names) == 2 else None, To: sheehan, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3002: stringutil: rename local email/names variables to their plural forms
sheehan created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY email and name variables are renamed to emails and names (respectively). This is because the email variable name shadows the email function within the stringutil module. Since we are renaming email, we also rename name for consistency. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3002 AFFECTED FILES mercurial/utils/stringutil.py CHANGE DETAILS diff --git a/mercurial/utils/stringutil.py b/mercurial/utils/stringutil.py --- a/mercurial/utils/stringutil.py +++ b/mercurial/utils/stringutil.py @@ -204,7 +204,7 @@ # name, email hold the parsed emails and names for each line # name_builder holds the words in a persons name -name, email = [], [] +names, emails = [], [] namebuilder = [] for element in line.split(): @@ -215,29 +215,29 @@ elif element.startswith('<') and element.endswith('>'): # We have found an email. # Parse it, and finalize any names from earlier -email.append(element[1:-1]) # Slice off the "<>" +emails.append(element[1:-1]) # Slice off the "<>" if namebuilder: -name.append(' '.join(namebuilder)) +names.append(' '.join(namebuilder)) namebuilder = [] # Break if we have found a second email, any other # data does not fit the spec for .mailmap -if len(email) > 1: +if len(emails) > 1: break else: # We have found another word in the committers name namebuilder.append(element) mailmapkey = mailmapping( -email=email[-1], -name=name[-1] if len(name) == 2 else None, +email=emails[-1], +name=names[-1] if len(names) == 2 else None, ) mailmap[mailmapkey] = mailmapping( -email=email[0], -name=name[0] if name else None, +email=emails[0], +name=names[0] if names else None, ) return mailmap To: sheehan, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3001: templatefuncs: remove redundant "or author" from mailmap return statement
sheehan created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3001 AFFECTED FILES mercurial/templatefuncs.py CHANGE DETAILS diff --git a/mercurial/templatefuncs.py b/mercurial/templatefuncs.py --- a/mercurial/templatefuncs.py +++ b/mercurial/templatefuncs.py @@ -185,7 +185,7 @@ data = repo.wvfs.tryread('.mailmap') cache['mailmap'] = stringutil.parsemailmap(data) -return stringutil.mapname(cache['mailmap'], author) or author +return stringutil.mapname(cache['mailmap'], author) @templatefunc('pad(text, width[, fillchar=\' \'[, left=False]])', argspec='text width fillchar left') To: sheehan, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3004: stringutil: edit comment to reflect actual data type name
sheehan created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY In development the data type used to hold an email/name pair was called a "mailmaptup" since it was implemented as a namedtuple. The implementation has since been changed to use an @attr.s decorated class named mailmapping. This commit changes a comment to reflect this change. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3004 AFFECTED FILES mercurial/utils/stringutil.py CHANGE DETAILS diff --git a/mercurial/utils/stringutil.py b/mercurial/utils/stringutil.py --- a/mercurial/utils/stringutil.py +++ b/mercurial/utils/stringutil.py @@ -300,7 +300,7 @@ if not isauthorwellformed(author) or not mailmap: return author -# Turn the user name into a mailmaptup +# Turn the user name into a mailmapping commit = mailmapping(name=person(author), email=email(author)) try: To: sheehan, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3000: addremove: remove opts from scmutil.addremove
khanchi97 added a subscriber: yuja. khanchi97 added a comment. I ran all the tests those are related to addremove and they are passing. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3000 To: khanchi97, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2999: infinitepush: use zope.interface to define indexapi interface
indygreg added a comment. Oh, when you add test coverage, watch out for `mysql.connector` being unavailable. You may want to register a fake module in `sys.modules['mysql.connector']` to ensure it always is available. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2999 To: pulkit, #hg-reviewers, indygreg Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2999: infinitepush: use zope.interface to define indexapi interface
indygreg requested changes to this revision. indygreg added a comment. This revision now requires changes to proceed. Please also add test coverage to `test-check-interfaces.py`, otherwise these interfaces mean practically nothing. `zope.interface` doesn't perform run-time interface conformance tests unless you explicitly instruct it to. For now, we're going to verify interfaces in `test-check-interfaces.py`. INLINE COMMENTS > indexapi.py:25 > > def __init__(self): > """Initializes the metadata store connection.""" `Interface` classes don't define `self` on methods. So please drop `self` from all these methods. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2999 To: pulkit, #hg-reviewers, indygreg Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2998: infinitepush: add tests for `hg pull -r `
This revision was automatically updated to reflect the committed changes. Closed by commit rHGb5caa13d1a73: infinitepush: add tests for `hg pull -r rev` (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2998?vs=7465=7475 REVISION DETAIL https://phab.mercurial-scm.org/D2998 AFFECTED FILES tests/test-infinitepush-ci.t CHANGE DETAILS diff --git a/tests/test-infinitepush-ci.t b/tests/test-infinitepush-ci.t --- a/tests/test-infinitepush-ci.t +++ b/tests/test-infinitepush-ci.t @@ -23,6 +23,7 @@ $ cd .. $ hg clone repo client -q + $ hg clone repo client2 -q $ cd client Pushing a new commit from the client to the server @@ -172,6 +173,43 @@ searching for changes no changes found +Pulling from second client to test `hg pull -r ` +-- + +Pulling the revision which is applied + + $ cd ../client2 + $ hg pull -r 6cb0989601f1 + pulling from $TESTTMP/repo + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + new changesets 6cb0989601f1 + (run 'hg update' to get a working copy) + $ hg glog + o 1:6cb0989601f1 added a + | public + @ 0:67145f466344 initialcommit + public + +Pulling the revision which is in bundlestore +XXX: we should support pulling revisions from bundlestore without client side +wrapping + + $ hg pull -r b4e4bce660512ad3e71189e14588a70ac8e31fef + pulling from $TESTTMP/repo + abort: unknown revision 'b4e4bce660512ad3e71189e14588a70ac8e31fef'! + [255] + $ hg glog + o 1:6cb0989601f1 added a + | public + @ 0:67145f466344 initialcommit + public + + $ cd ../client + Checking storage of phase information with the bundle on bundlestore - To: pulkit, #hg-reviewers, indygreg Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2994: bunlde2: add 'source' as an optional argument to processbundle()
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9041c91561fc: bunlde2: add source as an optional argument to processbundle() (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2994?vs=7461=7471 REVISION DETAIL https://phab.mercurial-scm.org/D2994 AFFECTED FILES mercurial/bundle2.py CHANGE DETAILS diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -350,7 +350,7 @@ tr.hookargs['source'] = source if url is not None and 'url' not in tr.hookargs: tr.hookargs['url'] = url -return processbundle(repo, unbundler, lambda: tr) +return processbundle(repo, unbundler, lambda: tr, source=source) else: # the transactiongetter won't be used, but we might as well set it op = bundleoperation(repo, lambda: tr) @@ -425,7 +425,7 @@ self.repo.ui.debug('bundle2-input-bundle: %i parts total\n' % self.count) -def processbundle(repo, unbundler, transactiongetter=None, op=None): +def processbundle(repo, unbundler, transactiongetter=None, op=None, source=''): """This function process a bundle, apply effect to/from a repo It iterates over each part then searches for and uses the proper handling To: pulkit, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2995: bundleoperation: pass the source argument from all the users
This revision was automatically updated to reflect the committed changes. Closed by commit rHGf7d3915d5b3a: bundleoperation: pass the source argument from all the users (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2995?vs=7462=7472 REVISION DETAIL https://phab.mercurial-scm.org/D2995 AFFECTED FILES mercurial/bundle2.py mercurial/exchange.py CHANGE DETAILS diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -1595,7 +1595,8 @@ _pullbundle2extraprepare(pullop, kwargs) bundle = pullop.remote.getbundle('pull', **pycompat.strkwargs(kwargs)) try: -op = bundle2.bundleoperation(pullop.repo, pullop.gettransaction) +op = bundle2.bundleoperation(pullop.repo, pullop.gettransaction, + source='pull') op.modes['bookmarks'] = 'records' bundle2.processbundle(pullop.repo, bundle, op=op) except bundle2.AbortFromPart as exc: @@ -2052,7 +2053,8 @@ gettransaction() op = bundle2.bundleoperation(repo, gettransaction, - captureoutput=captureoutput) + captureoutput=captureoutput, + source='push') try: op = bundle2.processbundle(repo, cg, op=op) finally: diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -353,7 +353,7 @@ return processbundle(repo, unbundler, lambda: tr, source=source) else: # the transactiongetter won't be used, but we might as well set it -op = bundleoperation(repo, lambda: tr) +op = bundleoperation(repo, lambda: tr, source=source) _processchangegroup(op, unbundler, tr, source, url, **kwargs) return op @@ -441,7 +441,7 @@ if op is None: if transactiongetter is None: transactiongetter = _notransaction -op = bundleoperation(repo, transactiongetter) +op = bundleoperation(repo, transactiongetter, source=source) # todo: # - replace this is a init function soon. # - exception catching To: pulkit, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2996: bundle2: make source a mandatory argument for bundle2.applybundle() (API)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG684a6a261f30: bundle2: make source a mandatory argument for bundle2.applybundle() (API) (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2996?vs=7463=7474 REVISION DETAIL https://phab.mercurial-scm.org/D2996 AFFECTED FILES mercurial/bundle2.py CHANGE DETAILS diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -342,7 +342,7 @@ to be created""" raise TransactionUnavailable() -def applybundle(repo, unbundler, tr, source=None, url=None, **kwargs): +def applybundle(repo, unbundler, tr, source, url=None, **kwargs): # transform me into unbundler.apply() as soon as the freeze is lifted if isinstance(unbundler, unbundle20): tr.hookargs['bundle2'] = '1' To: pulkit, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2997: infinitepush: use bundleoperation.source instead of hacking on tr
This revision was automatically updated to reflect the committed changes. Closed by commit rHG40ee0af04e3a: infinitepush: use bundleoperation.source instead of hacking on tr (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2997?vs=7464=7473 REVISION DETAIL https://phab.mercurial-scm.org/D2997 AFFECTED FILES hgext/infinitepush/__init__.py CHANGE DETAILS diff --git a/hgext/infinitepush/__init__.py b/hgext/infinitepush/__init__.py --- a/hgext/infinitepush/__init__.py +++ b/hgext/infinitepush/__init__.py @@ -927,10 +927,8 @@ def processparts(orig, repo, op, unbundler): # make sure we don't wrap processparts in case of `hg unbundle` -tr = repo.currenttransaction() -if tr: -if tr.names[0].startswith('unbundle'): -return orig(repo, op, unbundler) +if op.source == 'unbundle': +return orig(repo, op, unbundler) # this server routes each push to bundle store if repo.ui.configbool('infinitepush', 'pushtobundlestore'): To: pulkit, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2998: infinitepush: add tests for `hg pull -r `
indygreg accepted this revision. indygreg added a comment. This revision is now accepted and ready to land. Oh, I assumed `hg pull -r` would magically work here. Boo. But at least we have test coverage for it now. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2998 To: pulkit, #hg-reviewers, indygreg Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2991: infinitepush: drop the default value of config options which are registered
This revision was automatically updated to reflect the committed changes. Closed by commit rHG912f4f64047f: infinitepush: drop the default value of config options which are registered (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2991?vs=7458=7468 REVISION DETAIL https://phab.mercurial-scm.org/D2991 AFFECTED FILES hgext/infinitepush/__init__.py CHANGE DETAILS diff --git a/hgext/infinitepush/__init__.py b/hgext/infinitepush/__init__.py --- a/hgext/infinitepush/__init__.py +++ b/hgext/infinitepush/__init__.py @@ -241,7 +241,7 @@ class bundlestore(object): def __init__(self, repo): self._repo = repo -storetype = self._repo.ui.config('infinitepush', 'storetype', '') +storetype = self._repo.ui.config('infinitepush', 'storetype') if storetype == 'disk': from . import store self.store = store.filebundlestore(self._repo.ui, self._repo) @@ -251,7 +251,7 @@ raise error.Abort( _('unknown infinitepush store type specified %s') % storetype) -indextype = self._repo.ui.config('infinitepush', 'indextype', '') +indextype = self._repo.ui.config('infinitepush', 'indextype') if indextype == 'disk': from . import fileindexapi self.index = fileindexapi.fileindexapi(self._repo) To: pulkit, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2992: infinitepush: don't force ipv6 while connecting to mysql server
This revision was automatically updated to reflect the committed changes. Closed by commit rHGc1fac3878196: infinitepush: dont force ipv6 while connecting to mysql server (authored by pulkit, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D2992?vs=7459=7469#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2992?vs=7459=7469 REVISION DETAIL https://phab.mercurial-scm.org/D2992 AFFECTED FILES hgext/infinitepush/sqlindexapi.py CHANGE DETAILS diff --git a/hgext/infinitepush/sqlindexapi.py b/hgext/infinitepush/sqlindexapi.py --- a/hgext/infinitepush/sqlindexapi.py +++ b/hgext/infinitepush/sqlindexapi.py @@ -60,8 +60,7 @@ retry = 3 while True: try: -self.sqlconn = mysql.connector.connect( -force_ipv6=True, **self.sqlargs) +self.sqlconn = mysql.connector.connect(**self.sqlargs) # Code is copy-pasted from hgsql. Bug fixes need to be # back-ported! To: pulkit, #hg-reviewers, indygreg Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 11 of 11] templater: drop global exception catcher from runfilter() (API)
On Sat, Mar 31, 2018 at 10:49:39AM +0900, Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara> # Date 1521359827 -32400 > # Sun Mar 18 16:57:07 2018 +0900 > # Node ID 9a2646947602dd11d7f65422e3ea27fabb3ee555 > # Parent bf00dda4a053a9dbf7163e993a454dd9dc03cb1f > templater: drop global exception catcher from runfilter() (API) queued, thanks ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2903: utils: add isauthorwellformed function
sheehan abandoned this revision. sheehan added a comment. Abandoning, this was landed as another differential. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2903 To: sheehan, #hg-reviewers Cc: yuja, lothiraldan, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2999: infinitepush: use zope.interface to define indexapi interface
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This patch makes indexapi use zope.interface which is now vendored with mercurial. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2999 AFFECTED FILES hgext/infinitepush/fileindexapi.py hgext/infinitepush/indexapi.py hgext/infinitepush/sqlindexapi.py CHANGE DETAILS diff --git a/hgext/infinitepush/sqlindexapi.py b/hgext/infinitepush/sqlindexapi.py --- a/hgext/infinitepush/sqlindexapi.py +++ b/hgext/infinitepush/sqlindexapi.py @@ -14,6 +14,10 @@ import warnings import mysql.connector +from mercurial.thirdparty.zope import ( +interface as zi, +) + from . import indexapi def _convertbookmarkpattern(pattern): @@ -23,7 +27,8 @@ pattern = pattern[:-1] + '%' return pattern -class sqlindexapi(indexapi.indexapi): +@zi.implementer(indexapi.indexapi) +class sqlindexapi(object): ''' Sql backend for infinitepush index. See schema.sql ''' diff --git a/hgext/infinitepush/indexapi.py b/hgext/infinitepush/indexapi.py --- a/hgext/infinitepush/indexapi.py +++ b/hgext/infinitepush/indexapi.py @@ -7,7 +7,11 @@ from __future__ import absolute_import -class indexapi(object): +from mercurial.thirdparty.zope import ( +interface as zi, +) + +class indexapi(zi.Interface): """Class that manages access to infinitepush index. This class is a context manager and all write operations (like diff --git a/hgext/infinitepush/fileindexapi.py b/hgext/infinitepush/fileindexapi.py --- a/hgext/infinitepush/fileindexapi.py +++ b/hgext/infinitepush/fileindexapi.py @@ -15,11 +15,16 @@ import os +from mercurial.thirdparty.zope import ( +interface as zi, +) + from mercurial.utils import stringutil from . import indexapi -class fileindexapi(indexapi.indexapi): +@zi.implementer(indexapi.indexapi) +class fileindexapi(object): def __init__(self, repo): super(fileindexapi, self).__init__() self._repo = repo To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2998: infinitepush: add tests for `hg pull -r `
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This patch adds test for `hg pull -r ` when the infinitepush extension is not present on the client side and the server by defaults pushes all the incoming push to bundlestore. As the tests show, if a the changeset was applied to the server, that can be pulled, but if a changeset is in the bundlestore we cannot pull that yet. We should support that. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2998 AFFECTED FILES tests/test-infinitepush-ci.t CHANGE DETAILS diff --git a/tests/test-infinitepush-ci.t b/tests/test-infinitepush-ci.t --- a/tests/test-infinitepush-ci.t +++ b/tests/test-infinitepush-ci.t @@ -23,6 +23,7 @@ $ cd .. $ hg clone repo client -q + $ hg clone repo client2 -q $ cd client Pushing a new commit from the client to the server @@ -172,6 +173,43 @@ searching for changes no changes found +Pulling from second client to test `hg pull -r ` +-- + +Pulling the revision which is applied + + $ cd ../client2 + $ hg pull -r 6cb0989601f1 + pulling from $TESTTMP/repo + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + new changesets 6cb0989601f1 + (run 'hg update' to get a working copy) + $ hg glog + o 1:6cb0989601f1 added a + | public + @ 0:67145f466344 initialcommit + public + +Pulling the revision which is in bundlestore +XXX: we should support pulling revisions from bundlestore without client side +wrapping + + $ hg pull -r b4e4bce660512ad3e71189e14588a70ac8e31fef + pulling from $TESTTMP/repo + abort: unknown revision 'b4e4bce660512ad3e71189e14588a70ac8e31fef'! + [255] + $ hg glog + o 1:6cb0989601f1 added a + | public + @ 0:67145f466344 initialcommit + public + + $ cd ../client + Checking storage of phase information with the bundle on bundlestore - To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2996: bundle2: make source a mandatory argument for bundle2.applybundle() (API)
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Currently all the callers in the core pass the source argument, making it mandatory will help us storing right source value in bundleoperation() class. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2996 AFFECTED FILES mercurial/bundle2.py CHANGE DETAILS diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -342,7 +342,7 @@ to be created""" raise TransactionUnavailable() -def applybundle(repo, unbundler, tr, source=None, url=None, **kwargs): +def applybundle(repo, unbundler, tr, source, url=None, **kwargs): # transform me into unbundler.apply() as soon as the freeze is lifted if isinstance(unbundler, unbundle20): tr.hookargs['bundle2'] = '1' To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2997: infinitepush: use bundleoperation.source instead of hacking on tr
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Previous patches added a soutce attribute to bundle2.bundleoperation class which stores the command which leads to current bundleoperation. Let's use that to decide whether a processing a `hg unbundle` or not instead of hacking on transaction. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2997 AFFECTED FILES hgext/infinitepush/__init__.py CHANGE DETAILS diff --git a/hgext/infinitepush/__init__.py b/hgext/infinitepush/__init__.py --- a/hgext/infinitepush/__init__.py +++ b/hgext/infinitepush/__init__.py @@ -927,10 +927,8 @@ def processparts(orig, repo, op, unbundler): # make sure we don't wrap processparts in case of `hg unbundle` -tr = repo.currenttransaction() -if tr: -if tr.names[0].startswith('unbundle'): -return orig(repo, op, unbundler) +if op.source == 'unbundle': +return orig(repo, op, unbundler) # this server routes each push to bundle store if repo.ui.configbool('infinitepush', 'pushtobundlestore'): To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2995: bundleoperation: pass the source argument from all the users
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY We now have a source attribute to the bundle2.bundleoperation class which stores the operation which leads to the current bundling/unbundling. Let's make sure we pass source argument from all the users of the command. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2995 AFFECTED FILES mercurial/bundle2.py mercurial/exchange.py CHANGE DETAILS diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -1595,7 +1595,8 @@ _pullbundle2extraprepare(pullop, kwargs) bundle = pullop.remote.getbundle('pull', **pycompat.strkwargs(kwargs)) try: -op = bundle2.bundleoperation(pullop.repo, pullop.gettransaction) +op = bundle2.bundleoperation(pullop.repo, pullop.gettransaction, + source='pull') op.modes['bookmarks'] = 'records' bundle2.processbundle(pullop.repo, bundle, op=op) except bundle2.AbortFromPart as exc: @@ -2052,7 +2053,8 @@ gettransaction() op = bundle2.bundleoperation(repo, gettransaction, - captureoutput=captureoutput) + captureoutput=captureoutput, + source='push') try: op = bundle2.processbundle(repo, cg, op=op) finally: diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -353,7 +353,7 @@ return processbundle(repo, unbundler, lambda: tr, source=source) else: # the transactiongetter won't be used, but we might as well set it -op = bundleoperation(repo, lambda: tr) +op = bundleoperation(repo, lambda: tr, source=source) _processchangegroup(op, unbundler, tr, source, url, **kwargs) return op @@ -441,7 +441,7 @@ if op is None: if transactiongetter is None: transactiongetter = _notransaction -op = bundleoperation(repo, transactiongetter) +op = bundleoperation(repo, transactiongetter, source=source) # todo: # - replace this is a init function soon. # - exception catching To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2993: bundle2: add 'source' atrribute to bundleoperation class
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This will help us in easily finding out which command leads to the current operation without hacking on the transaction. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2993 AFFECTED FILES mercurial/bundle2.py CHANGE DETAILS diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -299,7 +299,7 @@ * a way to construct a bundle response when applicable. """ -def __init__(self, repo, transactiongetter, captureoutput=True): +def __init__(self, repo, transactiongetter, captureoutput=True, source=''): self.repo = repo self.ui = repo.ui self.records = unbundlerecords() @@ -309,6 +309,7 @@ self._gettransaction = transactiongetter # carries value that can modify part behavior self.modes = {} +self.source = source def gettransaction(self): transaction = self._gettransaction() To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2994: bunlde2: add 'source' as an optional argument to processbundle()
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This will help us to pass the source variable to bundleoperation class. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2994 AFFECTED FILES mercurial/bundle2.py CHANGE DETAILS diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -350,7 +350,7 @@ tr.hookargs['source'] = source if url is not None and 'url' not in tr.hookargs: tr.hookargs['url'] = url -return processbundle(repo, unbundler, lambda: tr) +return processbundle(repo, unbundler, lambda: tr, source=source) else: # the transactiongetter won't be used, but we might as well set it op = bundleoperation(repo, lambda: tr) @@ -425,7 +425,7 @@ self.repo.ui.debug('bundle2-input-bundle: %i parts total\n' % self.count) -def processbundle(repo, unbundler, transactiongetter=None, op=None): +def processbundle(repo, unbundler, transactiongetter=None, op=None, source=''): """This function process a bundle, apply effect to/from a repo It iterates over each part then searches for and uses the proper handling To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2992: infinitepush: don't force ipv6 while connecting to mysql server
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Facebook internally enforces this but looks like we can't force this for pur users. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2992 AFFECTED FILES hgext/infinitepush/sqlindexapi.py CHANGE DETAILS diff --git a/hgext/infinitepush/sqlindexapi.py b/hgext/infinitepush/sqlindexapi.py --- a/hgext/infinitepush/sqlindexapi.py +++ b/hgext/infinitepush/sqlindexapi.py @@ -61,7 +61,7 @@ while True: try: self.sqlconn = mysql.connector.connect( -force_ipv6=True, **self.sqlargs) +force_ipv6=False, **self.sqlargs) # Code is copy-pasted from hgsql. Bug fixes need to be # back-ported! To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2991: infinitepush: drop the default value of config options which are registered
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2991 AFFECTED FILES hgext/infinitepush/__init__.py CHANGE DETAILS diff --git a/hgext/infinitepush/__init__.py b/hgext/infinitepush/__init__.py --- a/hgext/infinitepush/__init__.py +++ b/hgext/infinitepush/__init__.py @@ -241,7 +241,7 @@ class bundlestore(object): def __init__(self, repo): self._repo = repo -storetype = self._repo.ui.config('infinitepush', 'storetype', '') +storetype = self._repo.ui.config('infinitepush', 'storetype') if storetype == 'disk': from . import store self.store = store.filebundlestore(self._repo.ui, self._repo) @@ -251,7 +251,7 @@ raise error.Abort( _('unknown infinitepush store type specified %s') % storetype) -indextype = self._repo.ui.config('infinitepush', 'indextype', '') +indextype = self._repo.ui.config('infinitepush', 'indextype') if indextype == 'disk': from . import fileindexapi self.index = fileindexapi.fileindexapi(self._repo) To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2990: infinitepush: replace `remotenames.hoist` with `remotenames.hoistedpeer`
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The remotenames.hoist config option was renamed to remotenames.hoistedpeer while moving to core as an extension. Let's start using the config option provided by the in-core extension. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2990 AFFECTED FILES hgext/infinitepush/__init__.py CHANGE DETAILS diff --git a/hgext/infinitepush/__init__.py b/hgext/infinitepush/__init__.py --- a/hgext/infinitepush/__init__.py +++ b/hgext/infinitepush/__init__.py @@ -233,7 +233,7 @@ ''' if common.isremotebooksenabled(ui): -hoist = ui.config('remotenames', 'hoist') + '/' +hoist = ui.config('remotenames', 'hoistedpeer') + '/' if remotebookmark.startswith(hoist): return remotebookmark[len(hoist):] return remotebookmark To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2989: context: drop support for changeid of type long (API?)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG97ab6f2dc3c3: context: drop support for changeid of type long (API?) (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2989?vs=7454=7456 REVISION DETAIL https://phab.mercurial-scm.org/D2989 AFFECTED FILES mercurial/context.py CHANGE DETAILS diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -419,8 +419,6 @@ self._node = repo.changelog.node(changeid) self._rev = changeid return -if not pycompat.ispy3 and isinstance(changeid, long): -changeid = "%d" % changeid if changeid == 'null': self._node = nullid self._rev = nullrev To: martinvonz, #hg-reviewers, yuja Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 2] server: refactor 'daemon_postexec' instructions into a dictionary
On Fri, 30 Mar 2018 23:39:51 -0400, Matt Harbison wrote: > # HG changeset patch > # User Matt Harbison> # Date 1522466506 14400 > # Fri Mar 30 23:21:46 2018 -0400 > # Node ID 6e77d0a68122a6513521c94c4b8256b7e6da6f93 > # Parent 45aa79668d4ee38866b0829786da076ef59b0381 > server: refactor 'daemon_postexec' instructions into a dictionary Queued, thanks. > +if opts['daemon_postexec']: > +for inst in opts['daemon_postexec']: > +if inst.startswith('unlink:'): > +postexecargs['unlink'] = inst[7:] > +elif inst.startswith('chdir:'): > +postexecargs['chdir'] = inst[6:] > +elif inst != 'none': > +raise error.Abort(_('invalid value for --daemon-postexec: > %s') > + % inst) [...] > -if opts['daemon_postexec']: > +if postexecargs: Dropped this change since --daemon-postexec argument may be 'none', but it should still be daemonized. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] lfs: drop a duplicate blob verification method
On Sat, 31 Mar 2018 00:16:30 -0400, Matt Harbison wrote: > # HG changeset patch > # User Matt Harbison> # Date 1522468951 14400 > # Sat Mar 31 00:02:31 2018 -0400 > # Node ID 9837cda5fd115adecf860d3a97e5a01c07ca72fc > # Parent f1f70b2610da96054c6750122092adbb24e7aea8 > lfs: drop a duplicate blob verification method Queued, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2978: cbor: import CBORDecoder and CBOREncoder
This revision was automatically updated to reflect the committed changes. Closed by commit rHG3bc609bcfe77: cbor: import CBORDecoder and CBOREncoder (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2978?vs=7432=7455 REVISION DETAIL https://phab.mercurial-scm.org/D2978 AFFECTED FILES mercurial/thirdparty/cbor/__init__.py CHANGE DETAILS diff --git a/mercurial/thirdparty/cbor/__init__.py b/mercurial/thirdparty/cbor/__init__.py --- a/mercurial/thirdparty/cbor/__init__.py +++ b/mercurial/thirdparty/cbor/__init__.py @@ -1 +1,10 @@ -from .cbor2 import load, loads, dump, dumps, CBORDecodeError, CBOREncodeError +from .cbor2 import ( +CBORDecodeError, +CBORDecoder, +CBOREncodeError, +CBOREncoder, +dump, +dumps, +load, +loads, +) To: indygreg, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] py3: fix fix doctests to be bytes-safe
On Sat, Mar 31, 2018 at 7:18 AM, Yuya Nishiharawrote: > # HG changeset patch > # User Yuya Nishihara > # Date 1522459698 -32400 > # Sat Mar 31 10:28:18 2018 +0900 > # Node ID 40be6a8728a046b3673a517af2a3e15574457728 > # Parent 2a2ce93e12f4a70fa4aa2efae74658e43cc0e989 > py3: fix fix doctests to be bytes-safe Queued this. Many thanks! ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2989: context: drop support for changeid of type long (API?)
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY I don't see a reason to support type long. It's pretty much the same type as int. There was some discussion about it on the mailing list around the time of https://phab.mercurial-scm.org/rHGff2f90503d64ccd462c5526b7e389f96fdf0fcca (context: work around `long` not existing on Python 3, 2017-03-11), but I couldn't find a good reason to keep it. There was some mention of hgtk doing "repo[long(rev)]", but that was in 2012. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2989 AFFECTED FILES mercurial/context.py CHANGE DETAILS diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -419,8 +419,6 @@ self._node = repo.changelog.node(changeid) self._rev = changeid return -if not pycompat.ispy3 and isinstance(changeid, long): -changeid = "%d" % changeid if changeid == 'null': self._node = nullid self._rev = nullrev To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel