Re: [PATCH 2 of 7] test-obsolete-bundle-strip: add testing of markers backup during strip

2017-06-02 Thread Martin von Zweigbergk via Mercurial-devel
On Fri, Jun 2, 2017 at 11:10 PM, Martin von Zweigbergk
 wrote:
> On Thu, Jun 1, 2017 at 6:39 AM, Pierre-Yves David
>  wrote:
>> # HG changeset patch
>> # User Pierre-Yves David 
>> # Date 1495763531 -7200
>> #  Fri May 26 03:52:11 2017 +0200
>> # Node ID 441ba7c32dd493207066bc1a84fa6a6a759b0971
>> # Parent  a9f5b20c68a41d7b2760e7f986c0968913d7c5bb
>> # EXP-Topic obsstrip
>> # Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
>> #  hg pull 
>> https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 441ba7c32dd4
>> test-obsolete-bundle-strip: add testing of markers backup during strip
>>
>> When applicable, we strip the revision tested in the test and we check that 
>> the
>> backup bundle contains the appropriate markers.
>>
>> diff --git a/tests/test-obsolete-bundle-strip.t 
>> b/tests/test-obsolete-bundle-strip.t
>> --- a/tests/test-obsolete-bundle-strip.t
>> +++ b/tests/test-obsolete-bundle-strip.t
>> @@ -2,9 +2,6 @@
>>  Test obsmarkers interaction with bundle and strip
>>  ==
>>
>> -The file currently only contains test for bundle.
>> -Testing of strip will happen some time soon (tm).
>> -
>>  Setup a repository with various case
>>  
>>
>> @@ -50,7 +47,7 @@ Config setup
>>> }
>>
>>  Function to compare the expected bundled obsmarkers with the actually 
>> bundled
>> -obsmarkers.
>> +obsmarkers. It also check the obsmarkers backed up during strip.
>>
>>$ testrevs () {
>>> revs="$1"
>> @@ -60,6 +57,7 @@ obsmarkers.
>>> markersfile="${prefix}-relevant-markers.txt"
>>> bundlefile="${prefix}-bundle.hg"
>>> contentfile="${prefix}-bundle-markers.hg"
>> +  > stripcontentfile="${prefix}-bundle-markers.hg"
>>> hg debugobsolete --hidden --rev "${revs}" | sed 's/^//' > 
>> "${markersfile}"
>>> echo '### Matched revisions###'
>>> hg log --hidden --rev "${revs}" | sort
>> @@ -73,6 +71,22 @@ obsmarkers.
>>> echo '### diff   ###'
>>> cmp "${markersfile}" "${contentfile}" || diff -u "${markersfile}" 
>> "${contentfile}"
>>> echo '#'
>> +  > # if the matched revs do not have children, we also check the 
>> result of strip
>> +  > orphan=`hg log --hidden -T '.\n' --rev "(not ${revs}) and 
>> (${revs}::)" | wc -l | sed -e 's/ //g'`

More importantly than the below, the "(not ${revs})" needs an extra
pair of parens around ${revs}. Currently some tests do "testrevs A +
B" and this becomes "(not A + B)" when it was mean to be "(not (A +
B))". I'll fix that in the followup too.

>
> nit: Someone with no children is not (necessarily) an orphan.
> "children" (or "numchildren") would make more sense. It's just a test
> case, so not very important, but I'll send a followup patch.
>
> Also, what's the "sed" for?
>
>> +  > if [ $orphan -eq 0 ];
>> +  > then
>> +  > printf "# stripping: "
>> +  > hg strip --hidden --rev "${revs}"
>> +  > hg debugbundle .hg/strip-backup/* | grep "obsmarkers --" -A 100 
>> | sed 1,2d > "${stripcontentfile}"
>> +  > echo '### Backup markers ###'
>> +  > cat "${stripcontentfile}"
>> +  > echo '### diff   ###'
>> +  > cmp "${markersfile}" "${stripcontentfile}" || diff -u 
>> "${markersfile}" "${stripcontentfile}"
>> +  > echo '#'
>> +  > hg unbundle .hg/strip-backup/* | sed 's/^/# unbundling: /'
>> +  > # clean up directory for the next test
>> +  > rm .hg/strip-backup/*
>> +  > fi
>>> }
>>
>>  root setup
>> @@ -126,6 +140,16 @@ Actual testing
>>a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 
>> 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +) 
>> {'user': 'test'}
>>### diff   ###
>>#
>> +  # stripping: saved backup bundle to 
>> $TESTTMP/simple-chain/.hg/strip-backup/84fcb0dfe17b-6454bbdc-backup.hg
>> +  ### Backup markers ###
>> +  a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 
>> 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +) 
>> {'user': 'test'}
>> +  ### diff   ###
>> +  #
>> +  # unbundling: adding changesets
>> +  # unbundling: adding manifests
>> +  # unbundling: adding file changes
>> +  # unbundling: added 1 changesets with 1 changes to 1 files (+1 heads)
>> +  # unbundling: (run 'hg heads' to see heads)
>>
>>$ testrevs 'desc("C-A1")'
>>### Matched revisions###
>> @@ -141,6 +165,18 @@ Actual testing
>>a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 
>> cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +) 
>> {'user': 'test'}
>>### diff   ###
>>#
>> +  # stripping: saved backup bundle to 
>> $TESTTMP/simple-chain/.hg/strip-backup/cf2c22470d67-fa0f07b0-backup.hg
>> +  ### Backup markers ###
>> +  84

Re: [PATCH 2 of 7] test-obsolete-bundle-strip: add testing of markers backup during strip

2017-06-02 Thread Martin von Zweigbergk via Mercurial-devel
On Thu, Jun 1, 2017 at 6:39 AM, Pierre-Yves David
 wrote:
> # HG changeset patch
> # User Pierre-Yves David 
> # Date 1495763531 -7200
> #  Fri May 26 03:52:11 2017 +0200
> # Node ID 441ba7c32dd493207066bc1a84fa6a6a759b0971
> # Parent  a9f5b20c68a41d7b2760e7f986c0968913d7c5bb
> # EXP-Topic obsstrip
> # Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
> #  hg pull 
> https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 441ba7c32dd4
> test-obsolete-bundle-strip: add testing of markers backup during strip
>
> When applicable, we strip the revision tested in the test and we check that 
> the
> backup bundle contains the appropriate markers.
>
> diff --git a/tests/test-obsolete-bundle-strip.t 
> b/tests/test-obsolete-bundle-strip.t
> --- a/tests/test-obsolete-bundle-strip.t
> +++ b/tests/test-obsolete-bundle-strip.t
> @@ -2,9 +2,6 @@
>  Test obsmarkers interaction with bundle and strip
>  ==
>
> -The file currently only contains test for bundle.
> -Testing of strip will happen some time soon (tm).
> -
>  Setup a repository with various case
>  
>
> @@ -50,7 +47,7 @@ Config setup
>> }
>
>  Function to compare the expected bundled obsmarkers with the actually bundled
> -obsmarkers.
> +obsmarkers. It also check the obsmarkers backed up during strip.
>
>$ testrevs () {
>> revs="$1"
> @@ -60,6 +57,7 @@ obsmarkers.
>> markersfile="${prefix}-relevant-markers.txt"
>> bundlefile="${prefix}-bundle.hg"
>> contentfile="${prefix}-bundle-markers.hg"
> +  > stripcontentfile="${prefix}-bundle-markers.hg"
>> hg debugobsolete --hidden --rev "${revs}" | sed 's/^//' > 
> "${markersfile}"
>> echo '### Matched revisions###'
>> hg log --hidden --rev "${revs}" | sort
> @@ -73,6 +71,22 @@ obsmarkers.
>> echo '### diff   ###'
>> cmp "${markersfile}" "${contentfile}" || diff -u "${markersfile}" 
> "${contentfile}"
>> echo '#'
> +  > # if the matched revs do not have children, we also check the result 
> of strip
> +  > orphan=`hg log --hidden -T '.\n' --rev "(not ${revs}) and 
> (${revs}::)" | wc -l | sed -e 's/ //g'`

nit: Someone with no children is not (necessarily) an orphan.
"children" (or "numchildren") would make more sense. It's just a test
case, so not very important, but I'll send a followup patch.

Also, what's the "sed" for?

> +  > if [ $orphan -eq 0 ];
> +  > then
> +  > printf "# stripping: "
> +  > hg strip --hidden --rev "${revs}"
> +  > hg debugbundle .hg/strip-backup/* | grep "obsmarkers --" -A 100 
> | sed 1,2d > "${stripcontentfile}"
> +  > echo '### Backup markers ###'
> +  > cat "${stripcontentfile}"
> +  > echo '### diff   ###'
> +  > cmp "${markersfile}" "${stripcontentfile}" || diff -u 
> "${markersfile}" "${stripcontentfile}"
> +  > echo '#'
> +  > hg unbundle .hg/strip-backup/* | sed 's/^/# unbundling: /'
> +  > # clean up directory for the next test
> +  > rm .hg/strip-backup/*
> +  > fi
>> }
>
>  root setup
> @@ -126,6 +140,16 @@ Actual testing
>a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 
> 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +) 
> {'user': 'test'}
>### diff   ###
>#
> +  # stripping: saved backup bundle to 
> $TESTTMP/simple-chain/.hg/strip-backup/84fcb0dfe17b-6454bbdc-backup.hg
> +  ### Backup markers ###
> +  a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 
> 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +) 
> {'user': 'test'}
> +  ### diff   ###
> +  #
> +  # unbundling: adding changesets
> +  # unbundling: adding manifests
> +  # unbundling: adding file changes
> +  # unbundling: added 1 changesets with 1 changes to 1 files (+1 heads)
> +  # unbundling: (run 'hg heads' to see heads)
>
>$ testrevs 'desc("C-A1")'
>### Matched revisions###
> @@ -141,6 +165,18 @@ Actual testing
>a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 
> cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +) 
> {'user': 'test'}
>### diff   ###
>#
> +  # stripping: saved backup bundle to 
> $TESTTMP/simple-chain/.hg/strip-backup/cf2c22470d67-fa0f07b0-backup.hg
> +  ### Backup markers ###
> +  84fcb0dfe17b256ebae52e05572993b9194c018a 
> a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 0 (Thu Jan 01 00:00:00 1970 +) 
> {'user': 'test'}
> +  a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 
> 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +) 
> {'user': 'test'}
> +  a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 
> cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +) 
> {'user': 'test'}
> 

[PATCH STABLE] status: don't crash if a lookup file disappears

2017-06-02 Thread Siddharth Agarwal
# HG changeset patch
# User Siddharth Agarwal 
# Date 1496467672 25200
#  Fri Jun 02 22:27:52 2017 -0700
# Branch stable
# Node ID d39f934da0c80a568486cd8645eb6bbe513f1f03
# Parent  62e42e2897502bcbaa3a57d3301c789309596391
status: don't crash if a lookup file disappears

This can happen if another process (even another hg process!) comes along and
removes the file at that time.

This partly resolves issue5584, but not completely -- a bogus dirstate update
can still happen. However, the full fix is too involved for stable.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1613,18 +1613,30 @@ class workingctx(committablectx):
 def _checklookup(self, files):
 # check for any possibly clean files
 if not files:
-return [], []
+return [], [], []
 
 modified = []
+deleted = []
 fixup = []
 pctx = self._parents[0]
 # do a full compare of any files that might have changed
 for f in sorted(files):
-if (f not in pctx or self.flags(f) != pctx.flags(f)
-or pctx[f].cmp(self[f])):
-modified.append(f)
-else:
-fixup.append(f)
+try:
+# This will return True for a file that got replaced by a
+# directory in the interim, but fixing that is pretty hard.
+if (f not in pctx or self.flags(f) != pctx.flags(f)
+or pctx[f].cmp(self[f])):
+modified.append(f)
+else:
+fixup.append(f)
+except OSError:
+# A file become inaccessible in between? Mark it as deleted,
+# matching dirstate behavior (issue5584).
+# The dirstate has more complex behavior around whether a
+# missing file matches a directory, etc, but we don't need to
+# bother with that: if f has made it to this point, we're sure
+# it's in the dirstate.
+deleted.append(f)
 
 # update dirstate for files that are actually clean
 if fixup:
@@ -1644,7 +1656,7 @@ class workingctx(committablectx):
 self._repo.dirstate.write(self._repo.currenttransaction())
 except error.LockError:
 pass
-return modified, fixup
+return modified, deleted, fixup
 
 def _dirstatestatus(self, match=None, ignored=False, clean=False,
 unknown=False):
@@ -1659,8 +1671,9 @@ class workingctx(committablectx):
 
 # check for any possibly clean files
 if cmp:
-modified2, fixup = self._checklookup(cmp)
+modified2, deleted2, fixup = self._checklookup(cmp)
 s.modified.extend(modified2)
+s.deleted.extend(deleted2)
 
 # update dirstate for files that are actually clean
 if fixup and listclean:
diff --git a/tests/test-dirstate-race.t b/tests/test-dirstate-race.t
--- a/tests/test-dirstate-race.t
+++ b/tests/test-dirstate-race.t
@@ -1,4 +1,5 @@
-  $ hg init
+  $ hg init repo
+  $ cd repo
   $ echo a > a
   $ hg add a
   $ hg commit -m test
@@ -31,3 +32,62 @@ Do we ever miss a sub-second change?:
   M a
   M a
 
+  $ echo test > b
+  $ mkdir dir1
+  $ echo test > dir1/c
+  $ echo test > d
+
+  $ echo test > e
+#if execbit
+A directory will typically have the execute bit -- make sure it doesn't get
+confused with a file with the exec bit set
+  $ chmod +x e
+#endif
+
+  $ hg add b dir1 d e
+  adding dir1/c
+  $ hg commit -m test2
+
+  $ cat >> $TESTTMP/dirstaterace.py << EOF
+  > from mercurial import (
+  > context,
+  > extensions,
+  > )
+  > def extsetup():
+  > extensions.wrapfunction(context.workingctx, '_checklookup', 
overridechecklookup)
+  > def overridechecklookup(orig, self, files):
+  > # make an update that changes the dirstate from underneath
+  > self._repo.ui.system(self._repo.ui.config('dirstaterace', 'command'), 
cwd=self._repo.root)
+  > return orig(self, files)
+  > EOF
+
+  $ hg debugrebuilddirstate
+  $ hg debugdirstate
+  n   0 -1 unset   a
+  n   0 -1 unset   b
+  n   0 -1 unset   d
+  n   0 -1 unset   dir1/c
+  n   0 -1 unset   e
+
+XXX Note that this returns M for files that got replaced by directories. This 
is
+definitely a bug, but the fix for that is hard and the next status run is fine
+anyway.
+
+  $ hg status --config extensions.dirstaterace=$TESTTMP/dirstaterace.py \
+  >   --config dirstaterace.command='rm b && rm -r dir1 && rm d && mkdir d && 
rm e && mkdir e'
+  M d
+  M e
+  ! b
+  ! dir1/c
+  $ hg debugdirstate
+  n 644  2 * a (glob)
+  n   0 -1 unset   b
+  n   0 -1 unset   d
+  n   0 -1 unset   dir1/c
+  n   0   

Re: [PATCH 1 of 3 ctx-cleanup] context: inline makememctx (API)

2017-06-02 Thread Martin von Zweigbergk via Mercurial-devel
On Wed, May 31, 2017 at 5:22 PM, Sean Farley  wrote:
> # HG changeset patch
> # User Sean Farley 
> # Date 1494536055 25200
> #  Thu May 11 13:54:15 2017 -0700
> # Branch wctxds
> # Node ID 9879720e90cf13e445d17fc22f53c071a22322d9
> # Parent  60b3e8946da728c377a3a6aadb785ae308084614
> context: inline makememctx (API)
>
> I have always thought it weird that we have a helper method instead of
> just using __init__. So, I ripped it out.
>
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> index 59e548a..d3dc0c2 100644
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -1107,15 +1107,17 @@ def tryimportone(ui, repo, hunk, parents
>  raise error.Abort(str(e))
>  if opts.get('exact'):
>  editor = None
>  else:
>  editor = getcommiteditor(editform='import.bypass')
> -memctx = context.makememctx(repo, (p1.node(), p2.node()),
> +memctx = context.memctx(repo, (p1.node(), p2.node()),
>  message,
> -user,
> -date,
> -branch, files, store,
> +files=files,
> +filectxfn=store,
> +user=user,
> +date=date,
> +branch=branch,
>  editor=editor)
>  n = memctx.commit()
>  finally:
>  store.close()
>  if opts.get('exact') and nocommit:
> diff --git a/mercurial/context.py b/mercurial/context.py
> index e2994e7..af1a4ec 100644
> --- a/mercurial/context.py
> +++ b/mercurial/context.py
> @@ -387,28 +387,10 @@ class basectx(object):
>  for l in r:
>  l.sort()
>
>  return r
>
> -
> -def makememctx(repo, parents, text, user, date, branch, files, store,
> -   editor=None, extra=None):
> -def getfilectx(repo, memctx, path):
> -data, mode, copied = store.getfile(path)
> -if data is None:
> -return None
> -islink, isexec = mode
> -return memfilectx(repo, path, data, islink=islink, isexec=isexec,
> -  copied=copied, memctx=memctx)
> -if extra is None:
> -extra = {}
> -if branch:
> -extra['branch'] = encoding.fromlocal(branch)
> -ctx = memctx(repo, parents, text, files, getfilectx, user,
> - date, extra, editor)
> -return ctx
> -
>  def _filterederror(repo, changeid):
>  """build an exception to be raised about a filtered changeid
>
>  This is extracted in a function to help extensions (eg: evolve) to
>  experiment with various message variants."""
> @@ -2048,24 +2030,36 @@ class memctx(committablectx):
>  # Mercurial <= 3.1 expects the filectxfn to raise IOError for missing 
> files.
>  # Extensions that need to retain compatibility across Mercurial 3.1 can 
> use
>  # this field to determine what to do in filectxfn.
>  _returnnoneformissingfiles = True
>
> -def __init__(self, repo, parents, text, files, filectxfn, user=None,
> - date=None, extra=None, editor=False):
> +def __init__(self, repo, parents, text, files, filectxfn=None, user=None,
> + date=None, extra=None, branch=None, editor=False):
>  super(memctx, self).__init__(repo, text, user, date, extra)
>  self._rev = None
>  self._node = None
>  parents = [(p or nullid) for p in parents]
>  p1, p2 = parents
>  self._parents = [changectx(self._repo, p) for p in (p1, p2)]
>  files = sorted(set(files))
>  self._files = files
> +if branch is not None:
> +self._extra['branch'] = encoding.fromlocal(branch)
>  self.substate = {}
>
> -# if store is not callable, wrap it in a function
> -if not callable(filectxfn):
> +if filectxfn is not None and isinstance(filectxfn, patch.filestore):
> +def getfilectx(repo, memctx, path):
> +data, mode, copied = filectxfn.getfile(path)
> +if data is None:
> +return None
> +islink, isexec = mode
> +return memfilectx(repo, path, data, islink=islink,
> +  isexec=isexec, copied=copied,
> +  memctx=memctx)
> +self._filectxfn = getfilectx
> +elif not callable(filectxfn):
> +# if store is not callable, wrap it in a function
>  def getfilectx(repo, memctx, path):
>  fctx = filectxfn[path]

filectxfn can now be None. In that case, it looks like we end up here
(callable(None) i

Re: [PATCH 1 of 3 ctx-cleanup] context: inline makememctx (API)

2017-06-02 Thread Martin von Zweigbergk via Mercurial-devel
On Wed, May 31, 2017 at 5:22 PM, Sean Farley  wrote:
> # HG changeset patch
> # User Sean Farley 
> # Date 1494536055 25200
> #  Thu May 11 13:54:15 2017 -0700
> # Branch wctxds
> # Node ID 9879720e90cf13e445d17fc22f53c071a22322d9
> # Parent  60b3e8946da728c377a3a6aadb785ae308084614
> context: inline makememctx (API)
>
> I have always thought it weird that we have a helper method instead of
> just using __init__. So, I ripped it out.
>
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> index 59e548a..d3dc0c2 100644
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -1107,15 +1107,17 @@ def tryimportone(ui, repo, hunk, parents
>  raise error.Abort(str(e))
>  if opts.get('exact'):
>  editor = None
>  else:
>  editor = getcommiteditor(editform='import.bypass')
> -memctx = context.makememctx(repo, (p1.node(), p2.node()),
> +memctx = context.memctx(repo, (p1.node(), p2.node()),
>  message,
> -user,
> -date,
> -branch, files, store,
> +files=files,
> +filectxfn=store,
> +user=user,
> +date=date,
> +branch=branch,
>  editor=editor)

Fixing indentation in flight. Also adding line break after "repo, "
for consistency.

>  n = memctx.commit()
>  finally:
>  store.close()
>  if opts.get('exact') and nocommit:
> diff --git a/mercurial/context.py b/mercurial/context.py
> index e2994e7..af1a4ec 100644
> --- a/mercurial/context.py
> +++ b/mercurial/context.py
> @@ -387,28 +387,10 @@ class basectx(object):
>  for l in r:
>  l.sort()
>
>  return r
>
> -
> -def makememctx(repo, parents, text, user, date, branch, files, store,
> -   editor=None, extra=None):
> -def getfilectx(repo, memctx, path):
> -data, mode, copied = store.getfile(path)
> -if data is None:
> -return None
> -islink, isexec = mode
> -return memfilectx(repo, path, data, islink=islink, isexec=isexec,
> -  copied=copied, memctx=memctx)
> -if extra is None:
> -extra = {}
> -if branch:
> -extra['branch'] = encoding.fromlocal(branch)
> -ctx = memctx(repo, parents, text, files, getfilectx, user,
> - date, extra, editor)
> -return ctx
> -
>  def _filterederror(repo, changeid):
>  """build an exception to be raised about a filtered changeid
>
>  This is extracted in a function to help extensions (eg: evolve) to
>  experiment with various message variants."""
> @@ -2048,24 +2030,36 @@ class memctx(committablectx):
>  # Mercurial <= 3.1 expects the filectxfn to raise IOError for missing 
> files.
>  # Extensions that need to retain compatibility across Mercurial 3.1 can 
> use
>  # this field to determine what to do in filectxfn.
>  _returnnoneformissingfiles = True
>
> -def __init__(self, repo, parents, text, files, filectxfn, user=None,
> - date=None, extra=None, editor=False):
> +def __init__(self, repo, parents, text, files, filectxfn=None, user=None,
> + date=None, extra=None, branch=None, editor=False):
>  super(memctx, self).__init__(repo, text, user, date, extra)
>  self._rev = None
>  self._node = None
>  parents = [(p or nullid) for p in parents]
>  p1, p2 = parents
>  self._parents = [changectx(self._repo, p) for p in (p1, p2)]
>  files = sorted(set(files))
>  self._files = files
> +if branch is not None:
> +self._extra['branch'] = encoding.fromlocal(branch)
>  self.substate = {}
>
> -# if store is not callable, wrap it in a function
> -if not callable(filectxfn):
> +if filectxfn is not None and isinstance(filectxfn, patch.filestore):
> +def getfilectx(repo, memctx, path):
> +data, mode, copied = filectxfn.getfile(path)
> +if data is None:
> +return None
> +islink, isexec = mode
> +return memfilectx(repo, path, data, islink=islink,
> +  isexec=isexec, copied=copied,
> +  memctx=memctx)
> +self._filectxfn = getfilectx
> +elif not callable(filectxfn):
> +# if store is not callable, wrap it in a function
>  def getfilectx(repo, memctx, path):
>  fctx = filectxfn[path]
>

Re: [PATCH] committablectx: extra is already normalized

2017-06-02 Thread Martin von Zweigbergk via Mercurial-devel
On Fri, Jun 2, 2017 at 7:35 PM, Yuya Nishihara  wrote:
> On Wed, 31 May 2017 17:11:57 -0700, Jun Wu wrote:
>> Looks good to me. I'd mention extra is normalized by "changelog.add" in
>> commit message.
>
> Perhaps this should say "normalized by committablectx.__init__". changelog.py
> normalizes extra in inverse direction.

Good catch. I'll update it in flight.

>
>> Excerpts from Sean Farley's message of 2017-05-31 15:54:24 -0700:
>> > # HG changeset patch
>> > # User Sean Farley 
>> > # Date 1494535870 25200
>> > #  Thu May 11 13:51:10 2017 -0700
>> > # Branch wctxds
>> > # Node ID 60b3e8946da728c377a3a6aadb785ae308084614
>> > # Parent  5313d98089f569efffaca25de60e73be04156713
>> > committablectx: extra is already normalized
>> >
>> > Avoid doing the same work again. Based on work done by Mads Kiilerix.
>> >
>> > diff --git a/mercurial/context.py b/mercurial/context.py
>> > index f1014ab..e2994e7 100644
>> > --- a/mercurial/context.py
>> > +++ b/mercurial/context.py
>> > @@ -2077,18 +2077,10 @@ class memctx(committablectx):
>> >  self._filectxfn = getfilectx
>> >  else:
>> >  # memoizing increases performance for e.g. vcs convert 
>> > scenarios.
>> >  self._filectxfn = makecachingfilectxfn(filectxfn)
>> >
>> > -if extra:
>> > -self._extra = extra.copy()
>> > -else:
>> > -self._extra = {}
>> > -
>> > -if self._extra.get('branch', '') == '':
>> > -self._extra['branch'] = 'default'
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 2 of 2] annotate: restructure formatter output to be nested list (BC)

2017-06-02 Thread Augie Fackler
On Sat, Jun 03, 2017 at 01:02:27AM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1496417124 -32400
> #  Sat Jun 03 00:25:24 2017 +0900
> # Node ID b6eb65cbc42b8c3b3a6e4a21827732fc8b56f1cf
> # Parent  52237356336d4141f9f1a31995276703cbb436b7
> annotate: restructure formatter output to be nested list (BC)

queued, thanks
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] help: clarify the choice of pager

2017-06-02 Thread Augie Fackler
On Fri, Jun 02, 2017 at 10:28:38AM -0700, Sean Farley wrote:
> Xavier Lepaul via Mercurial-devel 
> writes:
>
> > # HG changeset patch
> > # User Xavier Lepaul 
> > # Date 1496393080 -7200
> > #  Fri Jun 02 10:44:40 2017 +0200
> > # Node ID 77a4708bafddb2599147c2dfc6eca47eaf9f3ba2
> > # Parent  e6ff007e107e434b35eb881711f459c7a75c91b2
> > help: clarify the choice of pager
> >
> > This follows the change made in d83e51654c8a to use environment variables
> > between system and user configuration.
>
> I think this could go on stable? Other reviewers?

queued for stable


> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] help: clarify the choice of pager

2017-06-02 Thread Augie Fackler
On Sat, Jun 03, 2017 at 12:09:21PM +0900, Yuya Nishihara wrote:
> On Fri, 02 Jun 2017 10:28:38 -0700, Sean Farley wrote:
> > Xavier Lepaul via Mercurial-devel 
> > writes:
> > > # HG changeset patch
> > > # User Xavier Lepaul 
> > > # Date 1496393080 -7200
> > > #  Fri Jun 02 10:44:40 2017 +0200
> > > # Node ID 77a4708bafddb2599147c2dfc6eca47eaf9f3ba2
> > > # Parent  e6ff007e107e434b35eb881711f459c7a75c91b2
> > > help: clarify the choice of pager
> > >
> > > This follows the change made in d83e51654c8a to use environment variables
> > > between system and user configuration.
> >
> > I think this could go on stable? Other reviewers?
>
> Sounds good to me. How's the release of 4.2.1 going?

We're unblocked on buildbot, I think, so just needs to happen either
Saturday or Monday. I suspect the latter is more likely.

> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH V2] setup: prevent setuptools from laying an egg

2017-06-02 Thread Augie Fackler
On Sat, Jun 03, 2017 at 12:25:31PM +0900, Yuya Nishihara wrote:
> On Sun, 28 May 2017 22:32:28 -0400, Matt Harbison wrote:
> > # HG changeset patch
> > # User Matt Harbison 
> > # Date 1494214143 14400
> > #  Sun May 07 23:29:03 2017 -0400
> > # Node ID b81e017073fbb68a878610377484c5d4d32f683c
> > # Parent  7422587f7788842413ebb2e6617749ed64895071
> > setup: prevent setuptools from laying an egg
>
> Looks good per the previous discussion, queued, thanks.

I also ran this by the pip maintainer and he said it looked like it'd
probably be okay. Just forgot to follow up here. :)

> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] solaris: solaris grep doesn't have -A; reimplement with awk

2017-06-02 Thread Yuya Nishihara
On Fri, 02 Jun 2017 16:20:06 -0700, danek.duv...@oracle.com wrote:
> # HG changeset patch
> # User Danek Duvall 
> # Date 1496445527 25200
> #  Fri Jun 02 16:18:47 2017 -0700
> # Node ID d41ec8a079648101eae94a25e05c6d7a7b26b653
> # Parent  e6ff007e107e434b35eb881711f459c7a75c91b2
> solaris: solaris grep doesn't have -A; reimplement with awk
> 
> diff --git a/tests/test-obsolete-bundle-strip.t 
> b/tests/test-obsolete-bundle-strip.t
> --- a/tests/test-obsolete-bundle-strip.t
> +++ b/tests/test-obsolete-bundle-strip.t
> @@ -67,7 +67,7 @@ obsmarkers.
>> cat "${markersfile}"
>> printf "# bundling: "
>> hg bundle --hidden --base "parents(roots(${revs}))" --rev "${revs}" 
> "${bundlefile}"
> -  > hg debugbundle "${bundlefile}" | grep "obsmarkers --" -A 100 | sed 
> 1,2d > "${contentfile}"
> +  > hg debugbundle "${bundlefile}" | awk '/obsmarkers --/ {p=1} p == 1 
> {print}' | sed 1,2d > "${contentfile}"

awk is new dependency. Can't we add an option to filter debugbundle output
(e.g. "hg debugbundle --part-type obsmarkers")?
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH V2] setup: prevent setuptools from laying an egg

2017-06-02 Thread Yuya Nishihara
On Sun, 28 May 2017 22:32:28 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison 
> # Date 1494214143 14400
> #  Sun May 07 23:29:03 2017 -0400
> # Node ID b81e017073fbb68a878610377484c5d4d32f683c
> # Parent  7422587f7788842413ebb2e6617749ed64895071
> setup: prevent setuptools from laying an egg

Looks good per the previous discussion, queued, thanks.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


mercurial@32607: 2 new changesets (2 on stable)

2017-06-02 Thread Mercurial Commits
2 new changesets (2 on stable) in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/7cecf18d3308
changeset:   32606:7cecf18d3308
branch:  stable
parent:  32578:8825de36e74a
user:Wagner Bruna 
date:Thu Jun 01 20:06:02 2017 -0300
summary: i18n-pt_BR: synchronized with 870248603a4e

https://www.mercurial-scm.org/repo/hg/rev/62e42e289750
changeset:   32607:62e42e289750
branch:  stable
tag: tip
user:Wagner Bruna 
date:Fri Jun 02 20:50:46 2017 -0300
summary: i18n-pt_BR: fix syntax error on translation

-- 
Repository URL: https://www.mercurial-scm.org/repo/hg
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH v2] patchbomb: add -B option to select a bookmark

2017-06-02 Thread Yuya Nishihara
On Fri, 02 Jun 2017 10:34:40 -0700, Sean Farley wrote:
> Yuya Nishihara  writes:
> > On Tue, 30 May 2017 11:14:11 +0200, David Demelier wrote:
> >> # HG changeset patch
> >> # User David Demelier 
> >> # Date 1486130547 -3600
> >> #  Fri Feb 03 15:02:27 2017 +0100
> >> # Node ID 78767485c1feff1593ca39c8986a29abd44cc567
> >> # Parent  1df80eff24cfbde6654149bd8aa969f246672405
> >> patchbomb: add -B option to select a bookmark
> >
> > Generally looks good. Queued, thanks.
> >
> > I found a couple of nits, so can you make follow-up patches?
> >
> >> diff -r 1df80eff24cf -r 78767485c1fe hgext/patchbomb.py
> >
> >> @@ -540,13 +547,16 @@
> >>  mbox = opts.get('mbox')
> >>  outgoing = opts.get('outgoing')
> >>  rev = opts.get('rev')
> >> +bookmark = opts.get('bookmark')
> >
> >> +# internal option used by pbranches
> >> +patches = opts.get('patches')
> >
> > This looks like a merge error. Dropped.
> >
> >> @@ -565,6 +575,10 @@
> >>  if revs:
> >>  raise error.Abort(_('use only one form to specify the 
> >> revision'))
> >>  revs = rev
> >> +elif bookmark:
> >
> > -r and -B are mutually exclusive, so we should reject if both are specified.
> >
> >> +if not bookmark in repo._bookmarks:
> >> +raise error.Abort(_("bookmark '%s' not found") % bookmark)
> >> +revs = repair.stripbmrevset(repo, bookmark)
> >
> > Perhaps stripbmrevset() needs a better name and should be moved to e.g. 
> > scmutil.
> 
> Is it not just 'BOOK%'?

Most likely, but stripbmrevset() also excludes descendants of the other
bookmarks.

  "- ancestors(bookmark() and not bookmark(%s))"
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] help: clarify the choice of pager

2017-06-02 Thread Yuya Nishihara
On Fri, 02 Jun 2017 10:28:38 -0700, Sean Farley wrote:
> Xavier Lepaul via Mercurial-devel 
> writes:
> > # HG changeset patch
> > # User Xavier Lepaul 
> > # Date 1496393080 -7200
> > #  Fri Jun 02 10:44:40 2017 +0200
> > # Node ID 77a4708bafddb2599147c2dfc6eca47eaf9f3ba2
> > # Parent  e6ff007e107e434b35eb881711f459c7a75c91b2
> > help: clarify the choice of pager
> >
> > This follows the change made in d83e51654c8a to use environment variables
> > between system and user configuration.
> 
> I think this could go on stable? Other reviewers?

Sounds good to me. How's the release of 4.2.1 going?
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] committablectx: extra is already normalized

2017-06-02 Thread Yuya Nishihara
On Wed, 31 May 2017 17:11:57 -0700, Jun Wu wrote:
> Looks good to me. I'd mention extra is normalized by "changelog.add" in
> commit message.

Perhaps this should say "normalized by committablectx.__init__". changelog.py
normalizes extra in inverse direction.

> Excerpts from Sean Farley's message of 2017-05-31 15:54:24 -0700:
> > # HG changeset patch
> > # User Sean Farley 
> > # Date 1494535870 25200
> > #  Thu May 11 13:51:10 2017 -0700
> > # Branch wctxds
> > # Node ID 60b3e8946da728c377a3a6aadb785ae308084614
> > # Parent  5313d98089f569efffaca25de60e73be04156713
> > committablectx: extra is already normalized
> > 
> > Avoid doing the same work again. Based on work done by Mads Kiilerix.
> > 
> > diff --git a/mercurial/context.py b/mercurial/context.py
> > index f1014ab..e2994e7 100644
> > --- a/mercurial/context.py
> > +++ b/mercurial/context.py
> > @@ -2077,18 +2077,10 @@ class memctx(committablectx):
> >  self._filectxfn = getfilectx
> >  else:
> >  # memoizing increases performance for e.g. vcs convert 
> > scenarios.
> >  self._filectxfn = makecachingfilectxfn(filectxfn)
> >  
> > -if extra:
> > -self._extra = extra.copy()
> > -else:
> > -self._extra = {}
> > -
> > -if self._extra.get('branch', '') == '':
> > -self._extra['branch'] = 'default'
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH stable] i18n-pt_BR: fix syntax error on translation

2017-06-02 Thread Augie Fackler
On Fri, Jun 02, 2017 at 08:55:46PM -0300, Wagner Bruna wrote:
> # HG changeset patch
> # User Wagner Bruna 
> # Date 1496447446 10800
> #  Fri Jun 02 20:50:46 2017 -0300
> # Branch stable
> # Node ID 642354dc9711ce1b9319eee3e83a9c81a217c706
> # Parent  8825de36e74a0c5e9ccf5419b2c217e5042a97cf
> i18n-pt_BR: fix syntax error on translation

Queued this for stable, many thanks.

>
> diff --git a/i18n/pt_BR.po b/i18n/pt_BR.po
> --- a/i18n/pt_BR.po
> +++ b/i18n/pt_BR.po
> @@ -19398,7 +19398,7 @@
>  "="
>
>  msgid "The following bundle  strings are available:"
> -msgstr "As seguintes strings de  estão disponíveis::"
> +msgstr "As seguintes strings de  estão disponíveis:"
>
>  msgid ""
>  "v1\n"
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH stable] i18n-pt_BR: fix syntax error on translation

2017-06-02 Thread Wagner Bruna

Em 02-06-2017 20:55, Wagner Bruna escreveu:

# HG changeset patch
# User Wagner Bruna 
# Date 1496447446 10800
#  Fri Jun 02 20:50:46 2017 -0300
# Branch stable
# Node ID 642354dc9711ce1b9319eee3e83a9c81a217c706
# Parent  8825de36e74a0c5e9ccf5419b2c217e5042a97cf
i18n-pt_BR: fix syntax error on translation


Sent as a patch because I can't access bitbucket right now for some reason. 
I'll push it to i18n after it lands on stable.


Sorry for the breakage.

Regards,
Wagner


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH] solaris: solaris grep doesn't have -A; reimplement with awk

2017-06-02 Thread danek . duvall
# HG changeset patch
# User Danek Duvall 
# Date 1496445527 25200
#  Fri Jun 02 16:18:47 2017 -0700
# Node ID d41ec8a079648101eae94a25e05c6d7a7b26b653
# Parent  e6ff007e107e434b35eb881711f459c7a75c91b2
solaris: solaris grep doesn't have -A; reimplement with awk

diff --git a/tests/test-obsolete-bundle-strip.t 
b/tests/test-obsolete-bundle-strip.t
--- a/tests/test-obsolete-bundle-strip.t
+++ b/tests/test-obsolete-bundle-strip.t
@@ -67,7 +67,7 @@ obsmarkers.
   > cat "${markersfile}"
   > printf "# bundling: "
   > hg bundle --hidden --base "parents(roots(${revs}))" --rev "${revs}" 
"${bundlefile}"
-  > hg debugbundle "${bundlefile}" | grep "obsmarkers --" -A 100 | sed 
1,2d > "${contentfile}"
+  > hg debugbundle "${bundlefile}" | awk '/obsmarkers --/ {p=1} p == 1 
{print}' | sed 1,2d > "${contentfile}"
   > echo '### Bundled markers ###'
   > cat "${contentfile}"
   > echo '### diff   ###'
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH stable] i18n-pt_BR: fix syntax error on translation

2017-06-02 Thread Wagner Bruna
# HG changeset patch
# User Wagner Bruna 
# Date 1496447446 10800
#  Fri Jun 02 20:50:46 2017 -0300
# Branch stable
# Node ID 642354dc9711ce1b9319eee3e83a9c81a217c706
# Parent  8825de36e74a0c5e9ccf5419b2c217e5042a97cf
i18n-pt_BR: fix syntax error on translation

diff --git a/i18n/pt_BR.po b/i18n/pt_BR.po
--- a/i18n/pt_BR.po
+++ b/i18n/pt_BR.po
@@ -19398,7 +19398,7 @@
 "="
 
 msgid "The following bundle  strings are available:"
-msgstr "As seguintes strings de  estão disponíveis::"
+msgstr "As seguintes strings de  estão disponíveis:"
 
 msgid ""
 "v1\n"

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 2] keepalive: set buffering=True to do more efficient reads of headers

2017-06-02 Thread Kyle Lippincott via Mercurial-devel
# HG changeset patch
# User Kyle Lippincott 
# Date 1496437706 25200
#  Fri Jun 02 14:08:26 2017 -0700
# Node ID daeaaad7839bb72ab48a09638ee4f1e8a089ca9d
# Parent  80511f08c101eae26b774a9759da271807e4bf0b
keepalive: set buffering=True to do more efficient reads of headers

Support for buffering was added to python in d09d6fe31b61, first released with
python2.7.  Without this, the entirety of the response headers is read
byte-by-byte (it does more efficient reads when it gets to the non-header part
of the response).

diff --git a/mercurial/keepalive.py b/mercurial/keepalive.py
--- a/mercurial/keepalive.py
+++ b/mercurial/keepalive.py
@@ -354,7 +354,8 @@
 
 def __init__(self, sock, debuglevel=0, strict=0, method=None):
 httplib.HTTPResponse.__init__(self, sock, debuglevel=debuglevel,
-  strict=True, method=method)
+  strict=True, method=method,
+  buffering=True)
 self.fileno = sock.fileno
 self.code = None
 self._rbuf = ''
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 2] keepalive: pass the correct arguments to HTTPResponse

2017-06-02 Thread Kyle Lippincott via Mercurial-devel
# HG changeset patch
# User Kyle Lippincott 
# Date 1496366600 25200
#  Thu Jun 01 18:23:20 2017 -0700
# Node ID 80511f08c101eae26b774a9759da271807e4bf0b
# Parent  5d44d7d4076e5a96001b0f88c730fa7ea24a9e02
keepalive: pass the correct arguments to HTTPResponse

python2.7's httplib.HTTPResponse takes the arguments in the following order:
sock, debuglevel, strict, method, buffering

This was previously passing them in as positional and skipped strict, so we set
strict=method.  I'm explicitly setting strict=True now to preserve the previous
behavior that has been there since this file was created.

diff --git a/mercurial/keepalive.py b/mercurial/keepalive.py
--- a/mercurial/keepalive.py
+++ b/mercurial/keepalive.py
@@ -353,7 +353,8 @@
 
 
 def __init__(self, sock, debuglevel=0, strict=0, method=None):
-httplib.HTTPResponse.__init__(self, sock, debuglevel, method)
+httplib.HTTPResponse.__init__(self, sock, debuglevel=debuglevel,
+  strict=True, method=method)
 self.fileno = sock.fileno
 self.code = None
 self._rbuf = ''
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: Test failure in i18n

2017-06-02 Thread Kevin Bullock
> On Jun 2, 2017, at 17:12, Kevin Bullock  
> wrote:
> 
> We have a test failure related to i18n/pt_BR.po that's blocking the 4.2.1 
> stable release:
> 
> --- /srv/buildbot/linuxtests/hg_tests__stable_/build/tests/test-gendoc-pt_BR.t
> +++ 
> /srv/buildbot/linuxtests/hg_tests__stable_/build/tests/test-gendoc-pt_BR.t.err
> @@ -2,3 +2,4 @@
> 
>   $ $TESTDIR/check-gendoc pt_BR
>   checking for parse errors
> +  gendoc.txt:2977: (WARNING/2) Literal block expected; none found.
> 
> ERROR: test-gendoc-pt_BR.t output changed
> 
> Unfortunately I have no idea how to track this down aside from somewhat 
> randomly changing strings that look vaguely suspicious. Anyone?

One detail I _can_ add is that the problem seems to have appeared somewhere 
after 7074589cf22a. I can't tell if it occurred because of a change in the 
source strings or in the pt_BR translation itself.

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock

___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Test failure in i18n

2017-06-02 Thread Kevin Bullock
We have a test failure related to i18n/pt_BR.po that's blocking the 4.2.1 
stable release:

--- /srv/buildbot/linuxtests/hg_tests__stable_/build/tests/test-gendoc-pt_BR.t
+++ 
/srv/buildbot/linuxtests/hg_tests__stable_/build/tests/test-gendoc-pt_BR.t.err
@@ -2,3 +2,4 @@
 
   $ $TESTDIR/check-gendoc pt_BR
   checking for parse errors
+  gendoc.txt:2977: (WARNING/2) Literal block expected; none found.

ERROR: test-gendoc-pt_BR.t output changed

Unfortunately I have no idea how to track this down aside from somewhat 
randomly changing strings that look vaguely suspicious. Anyone?

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock

___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 1 of 6 RFC] radixlink: introduce a new data structure

2017-06-02 Thread Jun Wu
Excerpts from Martin von Zweigbergk's message of 2017-06-02 10:38:08 -0700:
> [...]
> Would good to say here what the radix/base is (16, IIUC).

Will do.

> > +@property
> > +def truthoffset(self):
> > +"""position of the append-only source of truth the index 
> > contains"""
> > +if len(self.indexdata) >= self.indexheader.size:
> > +return self.indexheader.unpack_from(self.indexdata)[0]
> > +return 0
> 
> Looks like this is just metadata that radixlink doesn't care about.
> Would it be hard to fit general metadata in there?

Do you have ideas about what metadata will we have?

I'm not very comfortable with the index header part either. Now I think
about it more, the header usually has a same logic concept (revision number
or file offset) like values stored in the linked list. Therefore it seems
cleaner to just move the special header to the linked list so the index file
becomes free of unnecessary parts.

For general purposing, the fact that this is a map provides some flexibility
already (use non-conflicted keys for extra metadata). Sometimes we may want
strings (ex. nodes) in the linked list.  That's doable by having another
append-only file and let the linked list point to it.

I have also thought about versioning. This is used in .hg/cache. It seems we
can just rename the cache file if there are format changes.

In V2, I'm implementing the full class in C (instead of just the "get"
method) to cut down minor overheads. So I'd prefer simplicity for now.

> > +rl1.destroy()
> 
> Hmm, you destroy it here, but then you use it just after. Maybe it
> should be called clear()?

Good idea. It'll be called "clear".
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] bitmanipulation: add missing include of string.h

2017-06-02 Thread Sean Farley
Martin von Zweigbergk via Mercurial-devel
 writes:

> # HG changeset patch
> # User Martin von Zweigbergk 
> # Date 1496424759 25200
> #  Fri Jun 02 10:32:39 2017 -0700
> # Node ID adcedfacf15920a7ac4b5c2b2ab57f65857b8340
> # Parent  7fcddf79634350fec32d8ed87242db6d773588d5
> bitmanipulation: add missing include of string.h
>
> That's where memcpy() is declared.

Seems fine to me, queued!


signature.asc
Description: PGP signature
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 1 of 6 RFC] radixlink: introduce a new data structure

2017-06-02 Thread Martin von Zweigbergk via Mercurial-devel
A few comments from a very partial review.


On Sun, May 21, 2017 at 6:31 PM, Jun Wu  wrote:
> # HG changeset patch
> # User Jun Wu 
> # Date 1495396237 25200
> #  Sun May 21 12:50:37 2017 -0700
> # Node ID fec85b1af16b0360e7bd78cd26d4d21edf678962
> # Parent  4e51b2a99847904f1cc5a9c74784f19d69e829d0
> # Available At https://bitbucket.org/quark-zju/hg-draft
> #  hg pull https://bitbucket.org/quark-zju/hg-draft -r 
> fec85b1af16b
> radixlink: introduce a new data structure
>
> The radixlink structure is designed to address several hard-to-solve
> performance issues in Mercurial. It is an on-disk radix-tree as index,
> linking to linked list as data (so it could store multiple values per key).

Would good to say here what the radix/base is (16, IIUC).

>
> For long, core Mercurial has no real key-value data structure, and various
> operations have suboptimal time complexity:
>
>   1. changelog.rev(node): O(len(repo))
>   2. obsstore.precursors[node]: O(len(markers))
>   3. adjustlinkrev slow path (a complex problem)
>
> The new data structure could make the first two O(len(node)), and provide a
> cache for linkrevs where the keys could be "filenode + path + '\0'".
>
> The next patches will try to solve the obsstore performance issue.
>
> diff --git a/mercurial/radixlink.py b/mercurial/radixlink.py
> new file mode 100644
> --- /dev/null
> +++ b/mercurial/radixlink.py
> @@ -0,0 +1,244 @@
> +# radixlink.py - on-disk radixtree index pointing to linked list data
> +#
> +# Copyright 2017 Facebook, Inc.
> +#
> +# This software may be used and distributed according to the terms of the
> +# GNU General Public License version 2 or any later version.
> +from __future__ import absolute_import
> +
> +import os
> +import struct
> +
> +from . import (
> +error,
> +)
> +
> +def _enlarge(buf, size):
> +"""enlarge a bytearray to at least given size"""
> +l = len(buf)
> +if l < size:
> +buf += bytearray(size - l)
> +
> +def _tob16(buf):
> +"""convert buffer to base16 bytearray"""
> +result = bytearray(len(buf) * 2)
> +for i, b in enumerate(bytearray(buf)):
> +result[i * 2] = b >> 4
> +result[i * 2 + 1] = b & 0xf
> +return result
> +
> +class radixlink(object):
> +"""multimap with O(len(key) + len([value])) lookup and O(len(key)) 
> insertion
> +
> +A "radixlink" structure consists of 2 files: indexfile, and linkfile.
> +
> +The indexfile is the radix tree with pointers to linkfile:
> +
> +indexdata:= index-header + index-entry-list
> +index-header := source of truth offset (8B)
> +index-entry-list := '' | index-entry-list + index-entry
> +index-entry  := radix-entry | leaf-entry
> +radix-entry  := '\0' + index-offset (4B) * 16
> +leaf-entry   := '\1' + link-offset (4B) + key-length (2B) + key
> +
> +note: leaf-entry is at least len(radix-entry) long so it could be
> +converted to radix-entry in-place.
> +
> +The linkfile is an append-only linked list:
> +
> +linkdata:= link-header + link-entry-list
> +link-header := '\0'
> +link-entry-list := '' | link-entry-list + link-entry
> +link-entry  := next-link-offset (4B) + value (4B)
> +
> +radixlink should be used as caches, source of truth should be an
> +append-only data structure. The header in indexfile consists an offset
> +about the append-only source of truth so revlink could be updated
> +incrementally.
> +
> +radixlink does not support two keys where one is prefix of the other.
> +Application should use same-length keys, or append unique suffix to avoid
> +that.
> +"""
> +
> +indexheader = struct.Struct('>Q')
> +indexoffset = struct.Struct('>I')
> +linkoffset = struct.Struct('>I')
> +
> +keylen = struct.Struct('>H')
> +radixentrysize = 1 + indexoffset.size * 16
> +
> +radixentrytype = 0
> +leafentrytype = 1
> +
> +linkentry = struct.Struct('>II')
> +
> +emptyindex = b'\0' * (indexheader.size + radixentrysize)
> +emptylink = b'\0'
> +
> +def __init__(self, vfs, indexfile, linkfile=None):
> +linkfile = linkfile or indexfile + '.l'
> +self.vfs = vfs
> +self.indexfile = indexfile
> +self.linkfile = linkfile
> +self.indexdata = bytearray(vfs.tryread(indexfile) or self.emptyindex)
> +self.linkdata = bytearray(vfs.tryread(linkfile) or self.emptylink)
> +self._dirty = False
> +
> +def flush(self):
> +if self._dirty:
> +for path, data in [(self.linkfile, self.linkdata),
> +   (self.indexfile, self.indexdata)]:
> +f = self.vfs(path, 'wb', atomictemp=True)
> +f.write(data)
> +f.close()
> +self._dirty = False
> +
> +@property
> +def truthoffset(self):
> +"""position of the append-only source of truth the index 

Re: [PATCH v2] patchbomb: add -B option to select a bookmark

2017-06-02 Thread Sean Farley
Yuya Nishihara  writes:

> On Tue, 30 May 2017 11:14:11 +0200, David Demelier wrote:
>> # HG changeset patch
>> # User David Demelier 
>> # Date 1486130547 -3600
>> #  Fri Feb 03 15:02:27 2017 +0100
>> # Node ID 78767485c1feff1593ca39c8986a29abd44cc567
>> # Parent  1df80eff24cfbde6654149bd8aa969f246672405
>> patchbomb: add -B option to select a bookmark
>
> Generally looks good. Queued, thanks.
>
> I found a couple of nits, so can you make follow-up patches?
>
>> diff -r 1df80eff24cf -r 78767485c1fe hgext/patchbomb.py
>
>> @@ -540,13 +547,16 @@
>>  mbox = opts.get('mbox')
>>  outgoing = opts.get('outgoing')
>>  rev = opts.get('rev')
>> +bookmark = opts.get('bookmark')
>
>> +# internal option used by pbranches
>> +patches = opts.get('patches')
>
> This looks like a merge error. Dropped.
>
>> @@ -565,6 +575,10 @@
>>  if revs:
>>  raise error.Abort(_('use only one form to specify the 
>> revision'))
>>  revs = rev
>> +elif bookmark:
>
> -r and -B are mutually exclusive, so we should reject if both are specified.
>
>> +if not bookmark in repo._bookmarks:
>> +raise error.Abort(_("bookmark '%s' not found") % bookmark)
>> +revs = repair.stripbmrevset(repo, bookmark)
>
> Perhaps stripbmrevset() needs a better name and should be moved to e.g. 
> scmutil.

Is it not just 'BOOK%'?


signature.asc
Description: PGP signature
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH] bitmanipulation: add missing include of string.h

2017-06-02 Thread Martin von Zweigbergk via Mercurial-devel
# HG changeset patch
# User Martin von Zweigbergk 
# Date 1496424759 25200
#  Fri Jun 02 10:32:39 2017 -0700
# Node ID adcedfacf15920a7ac4b5c2b2ab57f65857b8340
# Parent  7fcddf79634350fec32d8ed87242db6d773588d5
bitmanipulation: add missing include of string.h

That's where memcpy() is declared.

diff --git a/mercurial/bitmanipulation.h b/mercurial/bitmanipulation.h
--- a/mercurial/bitmanipulation.h
+++ b/mercurial/bitmanipulation.h
@@ -1,6 +1,8 @@
 #ifndef _HG_BITMANIPULATION_H_
 #define _HG_BITMANIPULATION_H_
 
+#include 
+
 #include "compat.h"
 
 static inline uint32_t getbe32(const char *c)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 2 of 3 RFC] context: start the move of wlock from repo to workingctx

2017-06-02 Thread Sean Farley
Yuya Nishihara  writes:

> On Thu, 01 Jun 2017 11:28:56 -0700, Sean Farley wrote:
>> Yuya Nishihara  writes:
>> > On Wed, 31 May 2017 17:25:21 -0700, Sean Farley wrote:
>> >> # HG changeset patch
>> >> # User Sean Farley 
>> >> # Date 1494537056 25200
>> >> #  Thu May 11 14:10:56 2017 -0700
>> >> # Branch wctxds
>> >> # Node ID 11f1b897d1475648a88ff0115954413f46bf4137
>> >> # Parent  498dae194ccf1e82caed51a02e6ce0b77f8d92e8
>> >> context: start the move of wlock from repo to workingctx
>> >
>> > Does it mean eventually workingctx will never be created more than once
>> > per repository?
>> >
>> > Current context objects aren't persistent, but dirstate and wlock should
>> > be single source of truth.
>> 
>> I haven't crossed that bridge yet, but yes, I think something like that
>> would need to happen. If you have ideas about how that could happen (or
>> are against it), please do tell.
>
> My gut feeling is we'll need a storage object behind workingctx anyway, which
> is currently served by localrepository. Maybe it's good idea to detach
> dirstate, wlock, and the data guarded by wlock from localrepo, but the object
> holding them wouldn't be a workingctx.

Not a bad idea. I'll look into that this weekend.


signature.asc
Description: PGP signature
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] help: clarify the choice of pager

2017-06-02 Thread Sean Farley
Xavier Lepaul via Mercurial-devel 
writes:

> # HG changeset patch
> # User Xavier Lepaul 
> # Date 1496393080 -7200
> #  Fri Jun 02 10:44:40 2017 +0200
> # Node ID 77a4708bafddb2599147c2dfc6eca47eaf9f3ba2
> # Parent  e6ff007e107e434b35eb881711f459c7a75c91b2
> help: clarify the choice of pager
>
> This follows the change made in d83e51654c8a to use environment variables
> between system and user configuration.

I think this could go on stable? Other reviewers?


signature.asc
Description: PGP signature
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[Bug 5585] New: Largefiles: addremove converts large files to normal files

2017-06-02 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=5585

Bug ID: 5585
   Summary: Largefiles: addremove converts large files to normal
files
   Product: Mercurial
   Version: 4.1
  Hardware: PC
OS: Linux
Status: UNCONFIRMED
  Severity: bug
  Priority: wish
 Component: largefiles
  Assignee: bugzi...@mercurial-scm.org
  Reporter: abcz2.upr...@gmail.com
CC: mercurial-devel@mercurial-scm.org, nato...@gmail.com

Largefiles: addremove converts large files to normal files after files where
renamed via OS. By contrast, `hg rename` leaves largefiles after rename. This
happens even when similarity is 100%.

The bad thing, user doesn't notice the transition.

Here is a test, that I would expect from addremove behavior (with corresponding
`hg rename` behavior):

-
  $ cat >> $HGRCPATH < [extensions]
  > largefiles=
  > EOF

  $ hg init lf_rename
  $ cd lf_rename

hg rename should change the path of largefiles in .hglf

  $ touch first_largefile
  $ hg add --large first_largefile
  $ hg commit -m "add"
  $ hg rename first_largefile dir/first_largefile
  $ hg commit -m "add"
  $ ls .hglf
  dir
  $ ls .hglf/dir
  first_largefile

addremove with largefiles should change largefiles path in .hglf

  $ touch largefile
  $ hg add --large largefile
  $ hg commit -m "added"

  $ ls .hglf
  dir
  largefile

  $ mkdir dir2
  $ mv largefile dir2
  $ hg addremove -s 100
  removing largefile
  adding dir2/largefile

and should convert largefile to normal file

  $ hg commit -m "renamed using addremove"
  $ ls .hglf/dir2
  largefile
  $ ls -d .hglf/*
  .hglf/dir
  .hglf/dir2
  $ ls .hg/store/data
  ~2ehglf
--

but here is the reality:

--
   $ hg commit -m "renamed using addremove"
   $ ls .hglf/dir2
-  largefile
+  ls: cannot access '.hglf/dir2': No such file or directory
+  [2] 
   $ ls -d .hglf/*
   .hglf/dir
-  .hglf/dir2
+  .hglf/largefile
   $ ls .hg/store/data
+  dir2 
   ~2ehglf
---

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 2] annotate: restructure formatter output to be nested list (BC)

2017-06-02 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1496417124 -32400
#  Sat Jun 03 00:25:24 2017 +0900
# Node ID b6eb65cbc42b8c3b3a6e4a21827732fc8b56f1cf
# Parent  52237356336d4141f9f1a31995276703cbb436b7
annotate: restructure formatter output to be nested list (BC)

Annotate data should be in [(file, [line...])...] form, but there was no
API to represent such data structure when I ported it to formatter. Now
we have fm.nested() and the -T option is still experimental, so we can fix
the data format.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -377,15 +377,18 @@ def annotate(ui, repo, *pats, **opts):
 
 for abs in ctx.walk(m):
 fctx = ctx[abs]
+rootfm.startitem()
+rootfm.data(abspath=abs, path=m.rel(abs))
 if not opts.get('text') and fctx.isbinary():
 rootfm.plain(_("%s: binary file\n")
  % ((pats and m.rel(abs)) or abs))
 continue
 
-fm = rootfm
+fm = rootfm.nested('lines')
 lines = fctx.annotate(follow=follow, linenumber=linenumber,
   skiprevs=skiprevs, diffopts=diffopts)
 if not lines:
+fm.end()
 continue
 formats = []
 pieces = []
@@ -407,6 +410,7 @@ def annotate(ui, repo, *pats, **opts):
 
 if not lines[-1][1].endswith('\n'):
 fm.plain('\n')
+fm.end()
 
 rootfm.end()
 
diff --git a/tests/test-annotate.t b/tests/test-annotate.t
--- a/tests/test-annotate.t
+++ b/tests/test-annotate.t
@@ -56,21 +56,18 @@ annotate (JSON)
   $ hg annotate -Tjson a
   [
{
-"line": "a\n",
-"rev": 0
+"abspath": "a",
+"lines": [{"line": "a\n", "rev": 0}],
+"path": "a"
}
   ]
 
   $ hg annotate -Tjson -cdfnul a
   [
{
-"date": [1.0, 0],
-"file": "a",
-"line": "a\n",
-"line_number": 1,
-"node": "8435f90966e442695d2ded29fdade2bac5ad8065",
-"rev": 0,
-"user": "nobody"
+"abspath": "a",
+"lines": [{"date": [1.0, 0], "file": "a", "line": "a\n", "line_number": 1, 
"node": "8435f90966e442695d2ded29fdade2bac5ad8065", "rev": 0, "user": 
"nobody"}],
+"path": "a"
}
   ]
 
@@ -88,6 +85,37 @@ annotate (JSON)
   > EOF
   $ hg ci -mb2 -d '2 0'
 
+annotate multiple files (JSON)
+
+  $ hg annotate -Tjson a b
+  [
+   {
+"abspath": "a",
+"lines": [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": 
"a\n", "rev": 1}],
+"path": "a"
+   },
+   {
+"abspath": "b",
+"lines": [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": 
"a\n", "rev": 1}, {"line": "b4\n", "rev": 3}, {"line": "b5\n", "rev": 3}, 
{"line": "b6\n", "rev": 3}],
+"path": "b"
+   }
+  ]
+
+annotate multiple files (template)
+
+  $ hg annotate -T'== {abspath} ==\n{lines % "{rev}: {line}"}' a b
+  == a ==
+  0: a
+  1: a
+  1: a
+  == b ==
+  0: a
+  1: a
+  1: a
+  3: b4
+  3: b5
+  3: b6
+
 annotate -n b
 
   $ hg annotate -n b
@@ -500,14 +528,9 @@ annotate modified file
   $ hg annotate -ncr "wdir()" -Tjson foo
   [
{
-"line": "foo\n",
-"node": "472b18db256d1e8282064eab4bfdaf48cbfe83cd",
-"rev": 11
-   },
-   {
-"line": "foofoo\n",
-"node": null,
-"rev": null
+"abspath": "foo",
+"lines": [{"line": "foo\n", "node": 
"472b18db256d1e8282064eab4bfdaf48cbfe83cd", "rev": 11}, {"line": "foofoo\n", 
"node": null, "rev": null}],
+"path": "foo"
}
   ]
 
@@ -742,6 +765,28 @@ check error cases
   hg: parse error: descend argument must be a boolean
   [255]
 
+Test empty annotate output
+
+  $ printf '\0' > binary
+  $ touch empty
+  $ hg ci -qAm 'add binary and empty files'
+
+  $ hg annotate binary empty
+  binary: binary file
+
+  $ hg annotate -Tjson binary empty
+  [
+   {
+"abspath": "binary",
+"path": "binary"
+   },
+   {
+"abspath": "empty",
+"lines": [],
+"path": "empty"
+   }
+  ]
+
 Test annotate with whitespace options
 
   $ cd ..
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 2] annotate: rename formatter variable

2017-06-02 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1496415912 -32400
#  Sat Jun 03 00:05:12 2017 +0900
# Node ID 52237356336d4141f9f1a31995276703cbb436b7
# Parent  8dda0a0e543c4ecd615cbd7981ffcaee313a8d30
annotate: rename formatter variable

So we can add a nested 'fm' of narrow scope.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -299,7 +299,7 @@ def annotate(ui, repo, *pats, **opts):
 
 ctx = scmutil.revsingle(repo, opts.get('rev'))
 
-fm = ui.formatter('annotate', opts)
+rootfm = ui.formatter('annotate', opts)
 if ui.quiet:
 datefunc = util.shortdate
 else:
@@ -309,7 +309,7 @@ def annotate(ui, repo, *pats, **opts):
 if node is None:
 return None
 else:
-return fm.hexfunc(node)
+return rootfm.hexfunc(node)
 if opts.get('changeset'):
 # omit "+" suffix which is appended to node hex
 def formatrev(rev):
@@ -325,11 +325,11 @@ def annotate(ui, repo, *pats, **opts):
 return '%d ' % rev
 def formathex(hex):
 if hex is None:
-return '%s+' % fm.hexfunc(ctx.p1().node())
+return '%s+' % rootfm.hexfunc(ctx.p1().node())
 else:
 return '%s ' % hex
 else:
-hexfn = fm.hexfunc
+hexfn = rootfm.hexfunc
 formatrev = formathex = str
 
 opmap = [('user', ' ', lambda x: x[0].user(), ui.shortuser),
@@ -351,7 +351,7 @@ def annotate(ui, repo, *pats, **opts):
 
 ui.pager('annotate')
 
-if fm.isplain():
+if rootfm.isplain():
 def makefunc(get, fmt):
 return lambda x: fmt(get(x))
 else:
@@ -378,9 +378,11 @@ def annotate(ui, repo, *pats, **opts):
 for abs in ctx.walk(m):
 fctx = ctx[abs]
 if not opts.get('text') and fctx.isbinary():
-fm.plain(_("%s: binary file\n") % ((pats and m.rel(abs)) or abs))
+rootfm.plain(_("%s: binary file\n")
+ % ((pats and m.rel(abs)) or abs))
 continue
 
+fm = rootfm
 lines = fctx.annotate(follow=follow, linenumber=linenumber,
   skiprevs=skiprevs, diffopts=diffopts)
 if not lines:
@@ -406,7 +408,7 @@ def annotate(ui, repo, *pats, **opts):
 if not lines[-1][1].endswith('\n'):
 fm.plain('\n')
 
-fm.end()
+rootfm.end()
 
 @command('archive',
 [('', 'no-decode', None, _('do not pass files through decoders')),
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 1 of 6 V2] obsstore: add a 'cachekey' method

2017-06-02 Thread Pierre-Yves David



On 06/01/2017 10:27 PM, Sean Farley wrote:

Pierre-Yves David  writes:


On 06/01/2017 07:05 PM, Martin von Zweigbergk wrote:

On Thu, Jun 1, 2017 at 9:48 AM, Jun Wu  wrote:

Excerpts from Pierre-Yves David's message of 2017-06-01 18:15:17 +0200:

On 05/20/2017 05:30 PM, Pierre-Yves David wrote:

# HG changeset patch
# User Pierre-Yves David 
# Date 1495191830 -7200
#  Fri May 19 13:03:50 2017 +0200
# Node ID 221be1ef98902fa695a709371f75e63f9b3e950a
# Parent  566cfe9cbbb9b163bb58c8666759a634badacdd7
# EXP-Topic obscache
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#  hg pull 
https://www.mercurial-scm.org/repo/users/marmoute/mercurial/  -r 221be1ef9890
obsstore: add a 'cachekey' method


What is the status of this series. V2 has been on the list for over 10
days and I still see it in patchwork. How can I help having it move
forward. There are various other improvements stuck behind this series.


I think V2 radixlink will be fast enough so this series look unnecessary.

I think adding revision numbers to obsstore components is what we should
avoid in design.

Not to say this series has perf issues with huge repos.


It looks like we need someone less biased than you two to decide which
(or both) of the series to take :-) I just need to find time to review
both of the series and see what I think (and then we'll continue
discussing, I guess). Or we could VC all three?


Both series are complementary and useful. Obscache is very efficient for
its purpose and the other one improve other aspect of evolution related
computation. We already have many rev indexed caches so nothing really
new here.


This was my thinking as well. Though, I'm not trying to muddy the waters
here.


The potential scaling issue on large repository of the obscache are easy
to overcome, I've a series fixing most of them already ready to be sent
once that one is in.


Ah, are those online somewhere?


Yes, you can find them at:


https://www.mercurial-scm.org/repo/users/marmoute/mercurial/log?rev=7d2b6e3cec41%3A%3A

Cheers,

--
Pierre-Yves David
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 6 of 6 V2] py3: add test to show `hg update` and `hg identify` works on Python 3

2017-06-02 Thread Yuya Nishihara
On Fri, 02 Jun 2017 12:33:14 +0200, Boris Feld wrote:
> I read the serie, it looks good!
> 
> I love the idea about the dict.update to avoid gc churns.
> 
> On Fri, 2017-06-02 at 14:16 +0530, Pulkit Goyal wrote:
> > # HG changeset patch
> > # User Pulkit Goyal <7895pul...@gmail.com>
> > # Date 1496265079 -19800
> > #  Thu Jun 01 02:41:19 2017 +0530
> > # Node ID 33317f49a756894824ccc799efa0e7473aeb275c
> > # Parent  f6a8bfcf09665b66f0698c0a0f40d48212da9458
> > py3: add test to show `hg update` and `hg identify` works on Python 3

Yeah, queued these, thanks.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH v2] patchbomb: add -B option to select a bookmark

2017-06-02 Thread Yuya Nishihara
On Tue, 30 May 2017 11:14:11 +0200, David Demelier wrote:
> # HG changeset patch
> # User David Demelier 
> # Date 1486130547 -3600
> #  Fri Feb 03 15:02:27 2017 +0100
> # Node ID 78767485c1feff1593ca39c8986a29abd44cc567
> # Parent  1df80eff24cfbde6654149bd8aa969f246672405
> patchbomb: add -B option to select a bookmark

Generally looks good. Queued, thanks.

I found a couple of nits, so can you make follow-up patches?

> diff -r 1df80eff24cf -r 78767485c1fe hgext/patchbomb.py

> @@ -540,13 +547,16 @@
>  mbox = opts.get('mbox')
>  outgoing = opts.get('outgoing')
>  rev = opts.get('rev')
> +bookmark = opts.get('bookmark')

> +# internal option used by pbranches
> +patches = opts.get('patches')

This looks like a merge error. Dropped.

> @@ -565,6 +575,10 @@
>  if revs:
>  raise error.Abort(_('use only one form to specify the revision'))
>  revs = rev
> +elif bookmark:

-r and -B are mutually exclusive, so we should reject if both are specified.

> +if not bookmark in repo._bookmarks:
> +raise error.Abort(_("bookmark '%s' not found") % bookmark)
> +revs = repair.stripbmrevset(repo, bookmark)

Perhaps stripbmrevset() needs a better name and should be moved to e.g. scmutil.

> +  Message-Id: 
> +  User-Agent: Mercurial-patchbomb/4.2+374-2f9ccd83ecf8

Masked these platform specific outputs.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH] help: clarify the choice of pager

2017-06-02 Thread Xavier Lepaul via Mercurial-devel
# HG changeset patch
# User Xavier Lepaul 
# Date 1496393080 -7200
#  Fri Jun 02 10:44:40 2017 +0200
# Node ID 77a4708bafddb2599147c2dfc6eca47eaf9f3ba2
# Parent  e6ff007e107e434b35eb881711f459c7a75c91b2
help: clarify the choice of pager

This follows the change made in d83e51654c8a to use environment variables
between system and user configuration.

diff -r e6ff007e107e -r 77a4708bafdd mercurial/help/pager.txt
--- a/mercurial/help/pager.txt  Thu Jun 01 00:40:52 2017 -0700
+++ b/mercurial/help/pager.txt  Fri Jun 02 10:44:40 2017 +0200
@@ -6,9 +6,10 @@
   [pager]
   pager = less -FRX
 
-If no pager is set, Mercurial uses the environment variable
-$PAGER. If neither pager.pager, nor $PAGER is set, a default pager
-will be used, typically `less` on Unix and `more` on Windows.
+If no pager is set in the user or repository configuration, Mercurial uses the
+environment variable $PAGER. If $PAGER is not set, pager.pager from the default
+or system configuration is used. If none of these are set, a default pager will
+be used, typically `less` on Unix and `more` on Windows.
 
 .. container:: windows
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 1 of 9] test: add a file dedicated to push race between clients

2017-06-02 Thread Yuya Nishihara
On Mon, 29 May 2017 01:11:23 +0200, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David 
> # Date 1495916698 -7200
> #  Sat May 27 22:24:58 2017 +0200
> # Node ID 91964bf217343464079f0d62fda986ba865a4fe5
> # Parent  b647b923486f38d83b92089eafa9faafaa79785d
> # EXP-Topic pushrace
> # Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
> #  hg pull 
> https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 91964bf21734
> test: add a file dedicated to push race between clients

Queued these, thanks.

> +  > def delete():
> +  > try:
> +  > os.unlink(watchpath)
> +  > except OSError, exc:

Changed to "OSError as exc".
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 1 of 6 V2] obsstore: add a 'cachekey' method

2017-06-02 Thread Yuya Nishihara
On Thu, 1 Jun 2017 15:28:19 -0700, Jun Wu wrote:
> Excerpts from Sean Farley's message of 2017-06-01 13:27:44 -0700:
> > > Both series are complementary and useful. Obscache is very efficient for 
> > > its purpose and the other one improve other aspect of evolution related 
> > > computation. We already have many rev indexed caches so nothing really 
> > > new here.
> > 
> > This was my thinking as well. Though, I'm not trying to muddy the waters
> > here.
> 
> There are 4 revsets: obsolete, unstable, bumped, and divergent. My patch
> speeds up all of them significantly while obscache only speeds up the first
> one.
> 
> I admit that obscache is slightly faster than indexing on the "obsolete"
> revset. But that perf difference would be like just 20ms for hg-committed. I
> think that 20ms does not justify the complexity of a complete
> (huge-repo-friendly) implementation obscache and the coupling with revision
> number in design. And I do think eventually we want the related revset to be
> lazy so there won't be noticeable perf difference.

I haven't read these patches carefully, but I like Jun's radixlink idea which
seemed clever. If the perf win is just a few tens of milliseconds, I prefer not
having two separate cache layers that could complicate things in future.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 2 of 3 RFC] context: start the move of wlock from repo to workingctx

2017-06-02 Thread Yuya Nishihara
On Thu, 01 Jun 2017 11:28:56 -0700, Sean Farley wrote:
> Yuya Nishihara  writes:
> > On Wed, 31 May 2017 17:25:21 -0700, Sean Farley wrote:
> >> # HG changeset patch
> >> # User Sean Farley 
> >> # Date 1494537056 25200
> >> #  Thu May 11 14:10:56 2017 -0700
> >> # Branch wctxds
> >> # Node ID 11f1b897d1475648a88ff0115954413f46bf4137
> >> # Parent  498dae194ccf1e82caed51a02e6ce0b77f8d92e8
> >> context: start the move of wlock from repo to workingctx
> >
> > Does it mean eventually workingctx will never be created more than once
> > per repository?
> >
> > Current context objects aren't persistent, but dirstate and wlock should
> > be single source of truth.
> 
> I haven't crossed that bridge yet, but yes, I think something like that
> would need to happen. If you have ideas about how that could happen (or
> are against it), please do tell.

My gut feeling is we'll need a storage object behind workingctx anyway, which
is currently served by localrepository. Maybe it's good idea to detach
dirstate, wlock, and the data guarded by wlock from localrepo, but the object
holding them wouldn't be a workingctx.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 06 of 10] py3: add support to pass bool type variable into pycompat.sysbytes()

2017-06-02 Thread Yuya Nishihara
On Fri, 2 Jun 2017 07:35:25 +0530, Pulkit Goyal wrote:
> > Maybe you want bytestr() instead?
> 
> I didn't thought about that, sorry. I will send a V2 with bytestr()
> and other changes. Can you please drop this and the next one before
> they get public.

Okay, pruned a0d174b5ba0b and ad84062b826c. And now I'm reviewing the
changesets to be rebased.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 6 of 6 V2] py3: add test to show `hg update` and `hg identify` works on Python 3

2017-06-02 Thread Boris Feld
I read the serie, it looks good!

I love the idea about the dict.update to avoid gc churns.

On Fri, 2017-06-02 at 14:16 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pul...@gmail.com>
> # Date 1496265079 -19800
> #  Thu Jun 01 02:41:19 2017 +0530
> # Node ID 33317f49a756894824ccc799efa0e7473aeb275c
> # Parent  f6a8bfcf09665b66f0698c0a0f40d48212da9458
> py3: add test to show `hg update` and `hg identify` works on Python 3
> 
> diff --git a/tests/test-py3-commands.t b/tests/test-py3-commands.t
> --- a/tests/test-py3-commands.t
> +++ b/tests/test-py3-commands.t
> @@ -222,3 +222,10 @@
>  "parents": [""]
> }
>    ]
> +
> +Show that update works now!
> +
> +  $ hg up 0
> +  0 files updated, 0 files merged, 1 files removed, 0 files
> unresolved
> +  $ hg identify
> +  71c96e924262
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 5 of 6 V2] py3: add a test to show `hg diff` works on Python 3

2017-06-02 Thread Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <7895pul...@gmail.com>
# Date 1496378640 -19800
#  Fri Jun 02 10:14:00 2017 +0530
# Node ID f6a8bfcf09665b66f0698c0a0f40d48212da9458
# Parent  d6d7a160ee30b4296c2750cbf341cc550fe1657f
py3: add a test to show `hg diff` works on Python 3

diff --git a/tests/test-py3-commands.t b/tests/test-py3-commands.t
--- a/tests/test-py3-commands.t
+++ b/tests/test-py3-commands.t
@@ -118,6 +118,13 @@
   $ $PYTHON3 $HGBIN add iota
   $ $PYTHON3 $HGBIN status
   A iota
+  $ hg diff --nodates --git
+  diff --git a/iota b/iota
+  new file mode 100644
+  --- /dev/null
+  +++ b/iota
+  @@ -0,0 +1,1 @@
+  +This is the file 'iota'.
   $ $PYTHON3 $HGBIN commit --message 'commit performed in Python 3'
   $ $PYTHON3 $HGBIN status
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 6 of 6 V2] py3: add test to show `hg update` and `hg identify` works on Python 3

2017-06-02 Thread Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <7895pul...@gmail.com>
# Date 1496265079 -19800
#  Thu Jun 01 02:41:19 2017 +0530
# Node ID 33317f49a756894824ccc799efa0e7473aeb275c
# Parent  f6a8bfcf09665b66f0698c0a0f40d48212da9458
py3: add test to show `hg update` and `hg identify` works on Python 3

diff --git a/tests/test-py3-commands.t b/tests/test-py3-commands.t
--- a/tests/test-py3-commands.t
+++ b/tests/test-py3-commands.t
@@ -222,3 +222,10 @@
 "parents": [""]
}
   ]
+
+Show that update works now!
+
+  $ hg up 0
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg identify
+  71c96e924262
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 6 V2] py3: use dict.update() instead of constructing lists and adding them

2017-06-02 Thread Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <7895pul...@gmail.com>
# Date 1496259842 -19800
#  Thu Jun 01 01:14:02 2017 +0530
# Node ID 754e0b7e0ef3c73971b44e9c3fb76ab27206893a
# Parent  5492f3cf2e0c0606a83ca239f1ec3fc4d8b4e3f0
py3: use dict.update() instead of constructing lists and adding them

dict.items() returned a list on Python 2 and whereas on Python 3 it returns a
view object. So we required a work around. Using dict.update() is better then
constructing lists as it should save us on gc churns.

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -419,8 +419,10 @@
 for f in u2u:
 _checkcopies(c2, c1, f, base, tca, dirtyc2, limit, data2)
 
-copy = dict(data1['copy'].items() + data2['copy'].items())
-fullcopy = dict(data1['fullcopy'].items() + data2['fullcopy'].items())
+copy = dict(data1['copy'])
+copy.update(data2['copy'])
+fullcopy = dict(data1['fullcopy'])
+fullcopy.update(data2['fullcopy'])
 
 if dirtyc1:
 _combinecopies(data2['incomplete'], data1['incomplete'], copy, diverge,
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 3 of 6 V2] py3: convert exception to bytes to pass into ui.warn()

2017-06-02 Thread Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <7895pul...@gmail.com>
# Date 1496379921 -19800
#  Fri Jun 02 10:35:21 2017 +0530
# Node ID a2c4837cd74f9ff787e4f085a7b216075fcd233e
# Parent  9c2175e859f45ed46936469a759e6c8b9004a22a
py3: convert exception to bytes to pass into ui.warn()

Here encoding.strtolocal() is used because exc maybe an IOError which could
contain a valid non-ascii unicode.

diff --git a/mercurial/hook.py b/mercurial/hook.py
--- a/mercurial/hook.py
+++ b/mercurial/hook.py
@@ -13,6 +13,7 @@
 from .i18n import _
 from . import (
 demandimport,
+encoding,
 error,
 extensions,
 pycompat,
@@ -97,7 +98,7 @@
  (hname, exc.args[0]))
 else:
 ui.warn(_('error: %s hook raised an exception: '
-   '%s\n') % (hname, exc))
+   '%s\n') % (hname, encoding.strtolocal(str(exc
 if throw:
 raise
 if not ui.tracebackflag:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 6 V2] py3: convert bool variables to bytes before passing into ui.debug()

2017-06-02 Thread Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <7895pul...@gmail.com>
# Date 1496263466 -19800
#  Thu Jun 01 02:14:26 2017 +0530
# Node ID 9c2175e859f45ed46936469a759e6c8b9004a22a
# Parent  754e0b7e0ef3c73971b44e9c3fb76ab27206893a
py3: convert bool variables to bytes before passing into ui.debug()

We can't pass unicodes to ui.debug() and hence we need to convert things to
bytes before passing them.

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -807,9 +807,12 @@
 ret = copies.mergecopies(repo, wctx, p2, pa)
 copy, movewithdir, diverge, renamedelete, dirmove = ret
 
+boolbm = pycompat.bytestr(bool(branchmerge))
+boolf = pycompat.bytestr(bool(force))
+boolm = pycompat.bytestr(bool(matcher))
 repo.ui.note(_("resolving manifests\n"))
 repo.ui.debug(" branchmerge: %s, force: %s, partial: %s\n"
-  % (bool(branchmerge), bool(force), bool(matcher)))
+  % (boolbm, boolf, boolm))
 repo.ui.debug(" ancestor: %s, local: %s, remote: %s\n" % (pa, wctx, p2))
 
 m1, m2, ma = wctx.manifest(), p2.manifest(), pa.manifest()
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 4 of 6 V2] py3: implement __bytes__ for committablectx

2017-06-02 Thread Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <7895pul...@gmail.com>
# Date 1496264118 -19800
#  Thu Jun 01 02:25:18 2017 +0530
# Node ID d6d7a160ee30b4296c2750cbf341cc550fe1657f
# Parent  a2c4837cd74f9ff787e4f085a7b216075fcd233e
py3: implement __bytes__ for committablectx

Before this method, calling bytes on workingctx or memctx calls
basectx.__bytes__ since the magic method was not defined for this class. When it
calls the method from basectx class, it returns TypeError because None is passed
into it.

After this commit `hg update -C` works on Python 3 if eol is not enabled.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1387,6 +1387,9 @@
 def __str__(self):
 return str(self._parents[0]) + r"+"
 
+def __bytes__(self):
+return bytes(self._parents[0]) + "+"
+
 def __nonzero__(self):
 return True
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel