Re: [PATCH 4 of 4 accept-scripts] land: add test documenting contents of take.log

2018-11-07 Thread Martin von Zweigbergk via Mercurial-devel
On Wed, Nov 7, 2018 at 5:06 PM Augie Fackler  wrote:

> # HG changeset patch
> # User Augie Fackler 
> # Date 1541634897 18000
> #  Wed Nov 07 18:54:57 2018 -0500
> # Node ID 3e0f9891db118868fe54315231ba52fc84501a37
> # Parent  69c1fd928cf6668e4ddbd6d26ebb53bb75e374c5
> land: add test documenting contents of take.log
>

This series looks good to me. Thanks! I'll let Kevin queue it (because I
have never done that and I'm too lazy to figure out how).
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 1 of 4 accept-scripts] cleanup: adapt for landing of extdata in core by removing ext{revset, template}

2018-11-07 Thread Martin von Zweigbergk via Mercurial-devel
On Wed, Nov 7, 2018 at 10:03 PM Martin von Zweigbergk 
wrote:

>
>
> On Wed, Nov 7, 2018 at 5:01 PM Augie Fackler  wrote:
>
>> diff --git a/tests/test-land.t b/tests/test-land.t
>> --- a/tests/test-land.t
>> +++ b/tests/test-land.t
>> @@ -102,3 +102,4 @@ We expect to land 3::6.
>>|
>>o  0:1ea7 default
>>
>> +  $ cat .hg/take.log
>>
>
> Was this meant to be here?
>
>
I just looked at patch 2/4 and it looks like it was meant to be there. Can
be moved in flight, I suppose.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 1 of 4 accept-scripts] cleanup: adapt for landing of extdata in core by removing ext{revset, template}

2018-11-07 Thread Martin von Zweigbergk via Mercurial-devel
On Wed, Nov 7, 2018 at 5:01 PM Augie Fackler  wrote:

> diff --git a/tests/test-land.t b/tests/test-land.t
> --- a/tests/test-land.t
> +++ b/tests/test-land.t
> @@ -102,3 +102,4 @@ We expect to land 3::6.
>|
>o  0:1ea7 default
>
> +  $ cat .hg/take.log
>

Was this meant to be here?
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 4 of 4 accept-scripts] land: add test documenting contents of take.log

2018-11-07 Thread Augie Fackler
# HG changeset patch
# User Augie Fackler 
# Date 1541634897 18000
#  Wed Nov 07 18:54:57 2018 -0500
# Node ID 3e0f9891db118868fe54315231ba52fc84501a37
# Parent  69c1fd928cf6668e4ddbd6d26ebb53bb75e374c5
land: add test documenting contents of take.log

I wrote this commit as a child of 66e6, before my refactor which broke
this functionality. That it passes after rebasing proves that my fix
actually fixed things to the old behavior. :)

diff --git a/tests/test-land.t b/tests/test-land.t
--- a/tests/test-land.t
+++ b/tests/test-land.t
@@ -22,6 +22,9 @@ If only r1 is accepted, land pulls it in
   date:Thu Jan 01 00:00:00 1970 +
   summary: Add alpha.
   
+We log the acceptance in the take.log file in the target:
+  $ cat target/.hg/take.log
+  eb8972173e1758e823d2198d43f85bf17fba7212 carol alice bob
 
 More complicated example built using debugbuilddag. This emulates a bug
 encountered during the hg 4.6 freeze.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 3 of 4 accept-scripts] land: reinstate functionality to record acceptances in the take.log file

2018-11-07 Thread Augie Fackler
# HG changeset patch
# User Augie Fackler 
# Date 1541634772 18000
#  Wed Nov 07 18:52:52 2018 -0500
# Node ID 69c1fd928cf6668e4ddbd6d26ebb53bb75e374c5
# Parent  93766fc0dafe96a41a18ddd74e1408fabd7d63ad
land: reinstate functionality to record acceptances in the take.log file

diff --git a/land b/land
--- a/land
+++ b/land
@@ -47,7 +47,7 @@ def _destcontains(node):
 # Find all accepted revisions
 all_accepted = [n for n in cq.draft() if cq.accepted(n)]
 
-acceptrange = collections.namedtuple('acceptrange', 'roots head')
+acceptrange = collections.namedtuple('acceptrange', 'roots head contents')
 
 def accepted_ranges(all_accepted):
 if not all_accepted:
@@ -71,15 +71,18 @@ def accepted_ranges(all_accepted):
 for head in accepted_heads:
 roots = []
 visit = [head]
+contents = []
 while visit:
 current = visit.pop(-1)
 if _destcontains(current):
 roots.append(current)
 elif current not in accepted_roots:
 visit.extend(parents[current])
+contents.append(current)
 else:
 roots.extend(parents[current])
-ranges.append(acceptrange(roots, head))
+contents.append(current)
+ranges.append(acceptrange(roots, head, contents))
 
 logging.debug('accepted roots: %s', ' '.join(accepted_roots))
 logging.debug('accepted heads: %s', ' '.join(accepted_heads))
@@ -102,15 +105,18 @@ for r in accepted_ranges(all_accepted):
 continue
 logging.debug('range %r is valid', r)
 heads.add(r.head)
-take.append(r.head)
+take.append(r)
 
 if take:
 logging.debug("landing changes in %s:", dest)
 cmd = "hg push -q -R %s %s" % (conf.source, dest)
-for t in take:
-logging.debug("\tlanding %s", t)
-cmd += " -r %s" % t
+allchanges = []
+for r in take:
+logging.debug("\tlanding %s", r.head)
+cmd += " -r %s" % r.head
+allchanges += r.contents
 
+logging.debug("landing changes with %r", cmd)
 ret = os.system(cmd)
 if ret:
 print "exited %d" % ret
@@ -118,6 +124,11 @@ if take:
 # move bookmark to head of default branch or stable during freeze
 os.system("hg book -R %s -fr 'heads(default::)' @" % dest)
 with open("%s/.hg/take.log" % dest, "a") as f:
-f.write(takelog)
+for node in allchanges:
+f.write('%(node)s %(author)s %(accepters)s\n' % {
+'node': node,
+'author': cq.author(node),
+'accepters': ' '.join(cq.accepted(node)),
+})
 else:
 logging.debug("not landing any changes")
diff --git a/tests/test-land.t b/tests/test-land.t
--- a/tests/test-land.t
+++ b/tests/test-land.t
@@ -103,5 +103,9 @@ We expect to land 3::6.
   o  0:1ea7 default
   
 The `land` script should have written useful information in .hg/take.log in
-the destination repository. BUG: this doesn't work :(
+the destination repository.
   $ cat .hg/take.log
+  ee2d47383a2e910ced48bb5b25d04c2c94a7495d alice alice bob
+  472110eab2fa3ee331c706b610596d9c40d00f01 alice alice bob
+  6cfb447dff0e28177a4bc60d2a20f5d449f322ee alice alice bob
+  0cccaca5797043d1bd484de71068c4e47384dc84 alice alice bob
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 4 accept-scripts] land: document regression I introduced in 214aea0ce915

2018-11-07 Thread Augie Fackler
# HG changeset patch
# User Augie Fackler 
# Date 1541633597 18000
#  Wed Nov 07 18:33:17 2018 -0500
# Node ID 93766fc0dafe96a41a18ddd74e1408fabd7d63ad
# Parent  fa593e6a69f59fef0a10a03671ec14b1aa59a283
land: document regression I introduced in 214aea0ce915

In the process of fixing merges, it turns out I dropped the code that
wrote acceptance information into the .hg/take.log in the destination
repo. Tragically, there was no test coverage for this, and as a result
we have no information on landing of changes since April. :(

diff --git a/tests/test-land.t b/tests/test-land.t
--- a/tests/test-land.t
+++ b/tests/test-land.t
@@ -102,4 +102,6 @@ We expect to land 3::6.
   |
   o  0:1ea7 default
   
+The `land` script should have written useful information in .hg/take.log in
+the destination repository. BUG: this doesn't work :(
   $ cat .hg/take.log
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 4 accept-scripts] cleanup: adapt for landing of extdata in core by removing ext{revset, template}

2018-11-07 Thread Augie Fackler
# HG changeset patch
# User Augie Fackler 
# Date 1541633026 18000
#  Wed Nov 07 18:23:46 2018 -0500
# Node ID fa593e6a69f59fef0a10a03671ec14b1aa59a283
# Parent  bafcc443cd52382c574822bd4fef2f83141b10e1
cleanup: adapt for landing of extdata in core by removing ext{revset,template}

These don't work on a modern Mercurial anyway. Tests updated to
demonstrate how to use extdata instead.

diff --git a/extrevset.py b/extrevset.py
deleted file mode 100644
--- a/extrevset.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# extrevset.py support external revset keywords
-#
-# Copyright (C) 2016 Matt Mackall 
-#
-# This software may be used and distributed according to the terms of the
-# GNU General Public License version 2 or any later version.
-
-from mercurial.i18n import _
-from mercurial import util
-from mercurial import registrar
-from mercurial import revset
-
-revsetpredicate = registrar.revsetpredicate()
-
-def buildrevset(name, cmd):
-@revsetpredicate('%s()' % name)
-def myrevset(repo, subset, x): # pylint: disable=unused-variable
-"""External shell revset"""
-revset.getargs(x, 0, 0, _("%s takes no arguments") % name)
-results = set()
-for l in util.popen(cmd):
-n = l.strip().split()[0]
-if n in repo:
-results.add(repo[n].rev())
-return revset.baseset([r for r in subset if r in results])
-
-def extsetup(ui):
-for k,v in ui.configitems("extrevset"):
-typ, cmd = v.split(':')
-if typ == "shell":
-buildrevset(k, cmd)
diff --git a/exttemplate.py b/exttemplate.py
deleted file mode 100644
--- a/exttemplate.py
+++ /dev/null
@@ -1,37 +0,0 @@
-# exttemplate.py support external template keywords
-#
-# Copyright (C) 2016 Matt Mackall 
-#
-# This software may be used and distributed according to the terms of the
-# GNU General Public License version 2 or any later version.
-
-from mercurial import util
-from mercurial import registrar
-
-templatekeyword = registrar.templatekeyword()
-
-def buildkeyword(name, cmd):
-# gets bound to closure
-cache = []
-
-@templatekeyword(name)
-def mykeyword(repo, ctx, **args): # pylint: 
disable=unused-variable,unused-argument
-"""External shell template keyword"""
-if not cache:
-results = {}
-for l in util.popen(cmd):
-try:
-k, v = l.strip().split(" ", 1)
-if k in repo:
-results[k] = v
-except ValueError:
-pass
-cache.append(results)
-results = cache[0]
-return results.get(ctx.hex(), "")
-
-def extsetup(ui):
-for k,v in ui.configitems("exttemplate"):
-typ, cmd = v.split(':')
-if typ == "shell":
-buildkeyword(k, cmd)
diff --git a/tests/lib.sh b/tests/lib.sh
--- a/tests/lib.sh
+++ b/tests/lib.sh
@@ -60,13 +60,11 @@ alias diffhash="$TESTDIR/../diffhash"
 alias update-diffhashes="$TESTDIR/../update-diffhashes"
 
 cat >> $HGRCPATH <> beta
   $ hg ci --amend --date '1 0' --message 'Add beta (corrected)'
-  saved backup bundle to 
$TESTTMP/source/.hg/strip-backup/9c1cf7d076f2-034e2cfa-amend-backup.hg (glob)
+  saved backup bundle to $TESTTMP/source/.hg/strip-backup/*.hg (glob)
 This "unknown revision" abort is because obsolete markers aren't enabled
 in the test repositories. It should be harmless.
   $ update-diffhashes
@@ -81,7 +81,7 @@ Now we amend the change, and record the 
 the approval doesn't follow it to the new node.
 
   $ hg ci --amend --message 'amended message of tip' --date '100 0'
-  saved backup bundle to 
$TESTTMP/source/.hg/strip-backup/4db820271774-59296beb-amend-backup.hg (glob)
+  saved backup bundle to 
$TESTTMP/source/.hg/strip-backup/4db820271774-59296beb-*.hg (glob)
   $ logpush tip alice alice
   $ accepted
   4db820271774eb2b1e5983449385a52e7469551c alice bob
diff --git a/tests/test-exttemplate.t b/tests/test-exttemplate.t
deleted file mode 100644
--- a/tests/test-exttemplate.t
+++ /dev/null
@@ -1,11 +0,0 @@
-  $ . "$TESTDIR/lib.sh"
-
-  $ cd source
-  $ hg log --template '{node|short} {reviewers}\n'
-  ff05b7beb451 alice
-  eb8972173e17 alice
-  6b70f47fc5e7 
-
-  $ hg log --template '{node|short} {reviewers}\n' --rev 'byalice()'
-  eb8972173e17 alice
-  ff05b7beb451 alice
diff --git a/tests/test-land.t b/tests/test-land.t
--- a/tests/test-land.t
+++ b/tests/test-land.t
@@ -102,3 +102,4 @@ We expect to land 3::6.
   |
   o  0:1ea7 default
   
+  $ cat .hg/take.log
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5243: resolve: fix mark-check when a file was deleted on one side (issue6020)

2018-11-07 Thread spectral (Kyle Lippincott)
spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  wvfs.open raises an error if one of the files does not exist. Ignoring the 
error
  if it's ENOENT is done in several other places in this code, so I'm in good
  company :)

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5243

AFFECTED FILES
  mercurial/commands.py
  tests/test-resolve.t

CHANGE DETAILS

diff --git a/tests/test-resolve.t b/tests/test-resolve.t
--- a/tests/test-resolve.t
+++ b/tests/test-resolve.t
@@ -616,3 +616,59 @@
 
 Done with commands.resolve.confirm tests:
   $ cd ..
+
+Test that commands.resolve.mark-check works even if there are deleted files:
+  $ hg init resolve-deleted
+  $ cd resolve-deleted
+  $ echo r0 > file1
+  $ hg ci -qAm r0
+  $ echo r1 > file1
+  $ hg ci -qm r1
+  $ hg co -qr 0
+  $ hg rm file1
+  $ hg ci -qm "r2 (delete file1)"
+
+(At this point we have r0 creating file1, and sibling commits r1 and r2, which
+ modify and delete file1, respectively)
+
+  $ hg merge -r 1
+  file 'file1' was deleted in local [working copy] but was modified in other 
[merge rev].
+  What do you want to do?
+  use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to 
abandon
+  [1]
+  $ hg resolve --list
+  U file1
+  $ hg resolve --mark --config commands.resolve.mark-check=abort
+  (no more unresolved files)
+  $ hg resolve --list
+  R file1
+  $ hg resolve --unmark file1
+  $ hg resolve --mark --config commands.resolve.mark-check=warn
+  (no more unresolved files)
+  $ hg resolve --list
+  R file1
+
+For completeness, let's try that in the opposite direction (merging r2 into r1,
+instead of r1 into r2):
+  $ hg update -qCr 1
+  $ hg merge -r 2
+  file 'file1' was deleted in other [merge rev] but was modified in local 
[working copy].
+  What do you want to do?
+  use (c)hanged version, (d)elete, or leave (u)nresolved? u
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to 
abandon
+  [1]
+  $ hg resolve --list
+  U file1
+  $ hg resolve --mark --config commands.resolve.mark-check=abort
+  (no more unresolved files)
+  $ hg resolve --list
+  R file1
+  $ hg resolve --unmark file1
+  $ hg resolve --mark --config commands.resolve.mark-check=warn
+  (no more unresolved files)
+  $ hg resolve --list
+  R file1
+  $ cd ..
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4917,8 +4917,12 @@
 
 if mark:
 if markcheck:
-with repo.wvfs(f) as fobj:
-fdata = fobj.read()
+try:
+with repo.wvfs(f) as fobj:
+fdata = fobj.read()
+except (IOError, OSError) as inst:
+if inst.errno != errno.ENOENT:
+raise
 if filemerge.hasconflictmarkers(fdata) and \
 ms[f] != mergemod.MERGE_RECORD_RESOLVED:
 hasconflictmarkers.append(f)



To: spectral, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5242: tests: make the commands.resolve.confirm tests not pollute the test-wide hgrc

2018-11-07 Thread spectral (Kyle Lippincott)
spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I want to add tests after these tests that create a new repo and use it, and 
was
  confused for a bit as to why they were seeing different behavior than I
  expected.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5242

AFFECTED FILES
  tests/test-resolve.t

CHANGE DETAILS

diff --git a/tests/test-resolve.t b/tests/test-resolve.t
--- a/tests/test-resolve.t
+++ b/tests/test-resolve.t
@@ -525,7 +525,7 @@
 
 Test when config option is set:
 ==
-  $ cat >> $HGRCPATH << EOF
+  $ cat >> .hg/hgrc << EOF
   > [ui]
   > interactive = True
   > [commands]



To: spectral, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5241: tests: fix a couple typos in test-resolve.t comments and add a comment

2018-11-07 Thread spectral (Kyle Lippincott)
spectral 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/D5241

AFFECTED FILES
  tests/test-resolve.t

CHANGE DETAILS

diff --git a/tests/test-resolve.t b/tests/test-resolve.t
--- a/tests/test-resolve.t
+++ b/tests/test-resolve.t
@@ -435,7 +435,7 @@
   $ hg resolve -l
   R file1
   R file2
-Test explicitly setting the otion to 'none'
+Test explicitly setting the option to 'none'
   $ hg resolve --unmark
   $ hg resolve -l
   U file1
@@ -583,7 +583,7 @@
   R emp3
 
 Test that commands.resolve.confirm respect --unmark option (only when no 
patterns args are given):
-===
+=
 
   $ hg resolve -u emp1
 
@@ -613,4 +613,6 @@
 
   $ hg rebase --abort
   rebase aborted
+
+Done with commands.resolve.confirm tests:
   $ cd ..



To: spectral, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5237: fix: add suboption for configuring execution order of tools

2018-11-07 Thread hooper (Danny Hooper)
hooper updated this revision to Diff 12473.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5237?vs=12461=12473

REVISION DETAIL
  https://phab.mercurial-scm.org/D5237

AFFECTED FILES
  hgext/fix.py
  tests/test-fix.t

CHANGE DETAILS

diff --git a/tests/test-fix.t b/tests/test-fix.t
--- a/tests/test-fix.t
+++ b/tests/test-fix.t
@@ -165,6 +165,26 @@
 [fix]
 failure = abort
   
+  When multiple tools are configured to affect a file, they execute in an order
+  defined by the :priority suboption. The priority suboption has a default 
value
+  of zero for each tool. Tools are executed in order of descending priority. 
The
+  execution order of tools with equal priority is unspecified. For example, you
+  could use the 'sort' and 'head' utilities to keep only the 10 smallest 
numbers
+  in a text file by ensuring that 'sort' runs before 'head':
+  
+[fix]
+sort:command = sort --numeric-sort
+head:command = head --lines=10
+sort:pattern = numbers.txt
+head:pattern = numbers.txt
+sort:priority = 2
+head:priority = 1
+  
+  To account for changes made by each tool, the line numbers used for
+  incremental formatting are recomputed before executing the next tool. So, 
each
+  tool may see different values for the arguments added by the :linerange
+  suboption.
+  
   list of commands:
   
fix   rewrite file content in changesets or working directory
@@ -1127,3 +1147,51 @@
   first
 
   $ cd ..
+
+The execution order of tools can be controlled. This example doesn't work if
+you sort after truncating, but the config defines the correct order while the
+definitions are out of order (which might imply the incorrect order given the
+implementation of fix). The goal is to use multiple tools to select the lowest
+5 numbers in the file.
+
+  $ hg init priorityexample
+  $ cd priorityexample
+
+  $ cat >> .hg/hgrc < [fix]
+  > head:command = head --lines=5
+  > head:pattern = numbers.txt
+  > head:priority = 1
+  > sort:command = sort --numeric-sort
+  > sort:pattern = numbers.txt
+  > sort:priority = 2
+  > EOF
+
+  $ printf "8\n2\n3\n6\n7\n4\n9\n5\n1\n0\n" > numbers.txt
+  $ hg add -q
+  $ hg fix -w
+  $ cat numbers.txt
+  0
+  1
+  2
+  3
+  4
+
+And of course we should be able to break this by reversing the execution order.
+Test negative priorities while we're at it.
+
+  $ cat >> .hg/hgrc < [fix]
+  > head:priority = -1
+  > sort:priority = -2
+  > EOF
+  $ printf "8\n2\n3\n6\n7\n4\n9\n5\n1\n0\n" > numbers.txt
+  $ hg fix -w
+  $ cat numbers.txt
+  2
+  3
+  6
+  7
+  8
+
+  $ cd ..
diff --git a/hgext/fix.py b/hgext/fix.py
--- a/hgext/fix.py
+++ b/hgext/fix.py
@@ -54,6 +54,24 @@
   [fix]
   failure = abort
 
+When multiple tools are configured to affect a file, they execute in an order
+defined by the :priority suboption. The priority suboption has a default value
+of zero for each tool. Tools are executed in order of descending priority. The
+execution order of tools with equal priority is unspecified. For example, you
+could use the 'sort' and 'head' utilities to keep only the 10 smallest numbers
+in a text file by ensuring that 'sort' runs before 'head'::
+
+  [fix]
+  sort:command = sort --numeric-sort
+  head:command = head --lines=10
+  sort:pattern = numbers.txt
+  head:pattern = numbers.txt
+  sort:priority = 2
+  head:priority = 1
+
+To account for changes made by each tool, the line numbers used for incremental
+formatting are recomputed before executing the next tool. So, each tool may see
+different values for the arguments added by the :linerange suboption.
 """
 
 from __future__ import absolute_import
@@ -100,10 +118,16 @@
 configitem = registrar.configitem(configtable)
 
 # Register the suboptions allowed for each configured fixer.
-FIXER_ATTRS = ('command', 'linerange', 'fileset', 'pattern')
+FIXER_ATTRS = {
+'command': None,
+'linerange': None,
+'fileset': None,
+'pattern': None,
+'priority': 0,
+}
 
-for key in FIXER_ATTRS:
-configitem('fix', '.*(:%s)?' % key, default=None, generic=True)
+for key, default in FIXER_ATTRS.items():
+configitem('fix', '.*(:%s)?' % key, default=default, generic=True)
 
 # A good default size allows most source code files to be fixed, but avoids
 # letting fixer tools choke on huge inputs, which could be surprising to the
@@ -602,18 +626,21 @@
 Each value is a Fixer object with methods that implement the behavior of 
the
 fixer's config suboptions. Does not validate the config values.
 """
-result = {}
+fixers = {}
 for name in fixernames(ui):
-result[name] = Fixer()
+fixers[name] = Fixer()
 attrs = ui.configsuboptions('fix', name)[1]
 if 'fileset' in attrs and 'pattern' not in attrs:
 ui.warn(_('the fix.tool:fileset config name is deprecated; '
   'please rename it to fix.tool:pattern\n'))
 attrs['pattern'] = attrs['fileset']
-for key in 

D5240: tests: fix up some import statements caught by Python 3

2018-11-07 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG71b8ad0ef3e0: tests: fix up some import statements caught 
by Python 3 (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5240?vs=12471=12472

REVISION DETAIL
  https://phab.mercurial-scm.org/D5240

AFFECTED FILES
  tests/test-remotefilelog-bundle2-legacy.t
  tests/test-remotefilelog-cacheprocess.t

CHANGE DETAILS

diff --git a/tests/test-remotefilelog-cacheprocess.t 
b/tests/test-remotefilelog-cacheprocess.t
--- a/tests/test-remotefilelog-cacheprocess.t
+++ b/tests/test-remotefilelog-cacheprocess.t
@@ -16,7 +16,9 @@
   $ cd ..
 
   $ cat > cacheprocess-logger.py < import sys, os, shutil
+  > import os
+  > import shutil
+  > import sys
   > f = open('$TESTTMP/cachelog.log', 'w')
   > srccache = os.path.join('$TESTTMP', 'oldhgcache')
   > def log(message):
diff --git a/tests/test-remotefilelog-bundle2-legacy.t 
b/tests/test-remotefilelog-bundle2-legacy.t
--- a/tests/test-remotefilelog-bundle2-legacy.t
+++ b/tests/test-remotefilelog-bundle2-legacy.t
@@ -6,8 +6,8 @@
 generaldelta to generaldelta interactions with bundle2 but legacy clients
 without changegroup2 support
   $ cat > testcg2.py << EOF
+  > import sys
   > from mercurial import changegroup, registrar, util
-  > import sys
   > cmdtable = {}
   > command = registrar.command(cmdtable)
   > @command('testcg2', norepo=True)
@@ -22,7 +22,7 @@
   $ hg testcg2 || exit 80
 
   $ cat > disablecg2.py << EOF
-  > from mercurial import changegroup, util, error
+  > from mercurial import changegroup, error, util
   > deleted = False
   > def reposetup(ui, repo):
   > global deleted



To: durin42, #hg-reviewers, martinvonz
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5240: tests: fix up some import statements caught by Python 3

2018-11-07 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I'm curious how the import checker manages to be so much more
  pedantic in Python 3, but not enough to bother exploring.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5240

AFFECTED FILES
  tests/test-remotefilelog-bundle2-legacy.t
  tests/test-remotefilelog-cacheprocess.t

CHANGE DETAILS

diff --git a/tests/test-remotefilelog-cacheprocess.t 
b/tests/test-remotefilelog-cacheprocess.t
--- a/tests/test-remotefilelog-cacheprocess.t
+++ b/tests/test-remotefilelog-cacheprocess.t
@@ -16,7 +16,9 @@
   $ cd ..
 
   $ cat > cacheprocess-logger.py < import sys, os, shutil
+  > import os
+  > import shutil
+  > import sys
   > f = open('$TESTTMP/cachelog.log', 'w')
   > srccache = os.path.join('$TESTTMP', 'oldhgcache')
   > def log(message):
diff --git a/tests/test-remotefilelog-bundle2-legacy.t 
b/tests/test-remotefilelog-bundle2-legacy.t
--- a/tests/test-remotefilelog-bundle2-legacy.t
+++ b/tests/test-remotefilelog-bundle2-legacy.t
@@ -6,8 +6,8 @@
 generaldelta to generaldelta interactions with bundle2 but legacy clients
 without changegroup2 support
   $ cat > testcg2.py << EOF
+  > import sys
   > from mercurial import changegroup, registrar, util
-  > import sys
   > cmdtable = {}
   > command = registrar.command(cmdtable)
   > @command('testcg2', norepo=True)
@@ -22,7 +22,7 @@
   $ hg testcg2 || exit 80
 
   $ cat > disablecg2.py << EOF
-  > from mercurial import changegroup, util, error
+  > from mercurial import changegroup, error, util
   > deleted = False
   > def reposetup(ui, repo):
   > global deleted



To: durin42, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5239: tests: replace `tac` reimplementation by `sort -r`

2018-11-07 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG0df4d93fdc27: tests: replace `tac` reimplementation by 
`sort -r` (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5239?vs=12467=12470

REVISION DETAIL
  https://phab.mercurial-scm.org/D5239

AFFECTED FILES
  tests/test-fix.t

CHANGE DETAILS

diff --git a/tests/test-fix.t b/tests/test-fix.t
--- a/tests/test-fix.t
+++ b/tests/test-fix.t
@@ -1,11 +1,6 @@
 A script that implements uppercasing of specific lines in a file. This
 approximates the behavior of code formatters well enough for our tests.
 
-  $ TAC="$TESTTMP/tac.py"
-  $ cat > $TAC < import sys
-  > print('\n'.join(sys.stdin.read().splitlines()[::-1]))
-  > EOF
   $ UPPERCASEPY="$TESTTMP/uppercase.py"
   $ cat > $UPPERCASEPY < import sys
@@ -1122,7 +1117,7 @@
   $ printf "first\nsecond\n" > bar.txt
   $ hg add -q
   $ hg fix -w --config fix.sometool:fileset=bar.txt \
-  >   --config fix.sometool:command="$PYTHON $TAC"
+  >   --config fix.sometool:command="sort -r"
   the fix.tool:fileset config name is deprecated; please rename it to 
fix.tool:pattern
 
   $ cat foo.whole



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


D5235: revlog: replace PyInt_AS_LONG with a more portable helper function

2018-11-07 Thread durin42 (Augie Fackler)
durin42 added a comment.


  In https://phab.mercurial-scm.org/D5235#78172, @yuja wrote:
  
  > > +/* Convert a PyInt or PyLong to a long. Returns false if there is an
  > >  +   error, in which case an exception will already have been set. */
  > >  +static inline bool pylong_to_long(PyObject *pylong, long *out)
  >
  > Nit: I prefer 0/-1 return value instead of bool since that's the convention
  >  of CPython API.
  
  
  I got lazy, but we can change it if we like.
  
  > 
  > 
  >> +  *out = PyLong_AsLong(pylong);
  >>  + return PyErr_Occurred() == NULL;
  > 
  > Perhaps, checking `*out != -1` can be a fast path, though I don't know how
  >  much we care about the performance here.
  
  I don't either, but it was easy to add the if statement.
  
  > 
  > 
  >>   static int rustla_contains(rustlazyancestorsObject *self, PyObject *rev)
  >>   {
  >> 
  >> - if (!(PyInt_Check(rev))) { + long lrev; +if 
(!pylong_to_long(rev, )) {  return 0;
  > 
  > Needs `PyErr_Clear() since `non_int in self` isn't an error.
  
  Good catch, fixed.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5235

To: durin42, #hg-reviewers
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5235: revlog: replace PyInt_AS_LONG with a more portable helper function

2018-11-07 Thread durin42 (Augie Fackler)
durin42 updated this revision to Diff 12469.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5235?vs=12458=12469

REVISION DETAIL
  https://phab.mercurial-scm.org/D5235

AFFECTED FILES
  mercurial/cext/revlog.c
  mercurial/cext/util.h

CHANGE DETAILS

diff --git a/mercurial/cext/util.h b/mercurial/cext/util.h
--- a/mercurial/cext/util.h
+++ b/mercurial/cext/util.h
@@ -58,4 +58,17 @@
return _PyDict_NewPresized(((1 + expected_size) / 2) * 3);
 }
 
+/* Convert a PyInt or PyLong to a long. Returns false if there is an
+   error, in which case an exception will already have been set. */
+static inline bool pylong_to_long(PyObject *pylong, long *out)
+{
+   *out = PyLong_AsLong(pylong);
+   /* Fast path to avoid hitting PyErr_Occurred if the value was obviously
+* not an error. */
+   if (*out != -1) {
+   return true;
+   }
+   return PyErr_Occurred() == NULL;
+}
+
 #endif /* _HG_UTIL_H_ */
diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c
--- a/mercurial/cext/revlog.c
+++ b/mercurial/cext/revlog.c
@@ -24,7 +24,6 @@
 #define PyInt_Check PyLong_Check
 #define PyInt_FromLong PyLong_FromLong
 #define PyInt_FromSsize_t PyLong_FromSsize_t
-#define PyInt_AS_LONG PyLong_AS_LONG
 #define PyInt_AsLong PyLong_AsLong
 #endif
 
@@ -161,10 +160,17 @@
 int maxrev)
 {
if (rev >= self->length) {
+   long tmp;
PyObject *tuple =
PyList_GET_ITEM(self->added, rev - self->length);
-   ps[0] = (int)PyInt_AS_LONG(PyTuple_GET_ITEM(tuple, 5));
-   ps[1] = (int)PyInt_AS_LONG(PyTuple_GET_ITEM(tuple, 6));
+   if (!pylong_to_long(PyTuple_GET_ITEM(tuple, 5), )) {
+   return -1;
+   }
+   ps[0] = (int)tmp;
+   if (!pylong_to_long(PyTuple_GET_ITEM(tuple, 6), )) {
+   return -1;
+   }
+   ps[1] = (int)tmp;
} else {
const char *data = index_deref(self, rev);
ps[0] = getbe32(data + 24);
@@ -464,7 +470,9 @@
if (iter == NULL)
return -2;
while ((iter_item = PyIter_Next(iter))) {
-   iter_item_long = PyInt_AS_LONG(iter_item);
+   if (!pylong_to_long(iter_item, _item_long)) {
+   return -1;
+   }
Py_DECREF(iter_item);
if (iter_item_long < min_idx)
min_idx = iter_item_long;
@@ -853,7 +861,11 @@
if (rev >= self->length) {
PyObject *tuple =
PyList_GET_ITEM(self->added, rev - self->length);
-   return (int)PyInt_AS_LONG(PyTuple_GET_ITEM(tuple, 3));
+   long ret;
+   if (!pylong_to_long(PyTuple_GET_ITEM(tuple, 3), )) {
+   return -2;
+   }
+   return (int)ret;
} else {
data = index_deref(self, rev);
if (data == NULL) {
@@ -1384,8 +1396,13 @@
char *node;
int rev;
 
-   if (PyInt_Check(value))
-   return index_get(self, PyInt_AS_LONG(value));
+   if (PyInt_Check(value)) {
+   long idx;
+   if (!pylong_to_long(value, )) {
+   return NULL;
+   }
+   return index_get(self, idx);
+   }
 
if (node_check(value, ) == -1)
return NULL;
@@ -1516,7 +1533,10 @@
char *node;
 
if (PyInt_Check(value)) {
-   long rev = PyInt_AS_LONG(value);
+   long rev;
+   if (!pylong_to_long(value, )) {
+   return -1;
+   }
return rev >= -1 && rev < index_length(self);
}
 
@@ -2404,10 +2424,12 @@
 
 static int rustla_contains(rustlazyancestorsObject *self, PyObject *rev)
 {
-   if (!(PyInt_Check(rev))) {
+   long lrev;
+   if (!pylong_to_long(rev, )) {
+   PyErr_Clear();
return 0;
}
-   return rustlazyancestors_contains(self->iter, PyInt_AS_LONG(rev));
+   return rustlazyancestors_contains(self->iter, lrev);
 }
 
 static PySequenceMethods rustla_sequence_methods = {



To: durin42, #hg-reviewers
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5238: tests: work around `tac` not being portable

2018-11-07 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG2ad56a9b983b: tests: work around `tac` not being portable 
(authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5238?vs=12466=12468

REVISION DETAIL
  https://phab.mercurial-scm.org/D5238

AFFECTED FILES
  tests/test-fix.t

CHANGE DETAILS

diff --git a/tests/test-fix.t b/tests/test-fix.t
--- a/tests/test-fix.t
+++ b/tests/test-fix.t
@@ -1,6 +1,11 @@
 A script that implements uppercasing of specific lines in a file. This
 approximates the behavior of code formatters well enough for our tests.
 
+  $ TAC="$TESTTMP/tac.py"
+  $ cat > $TAC < import sys
+  > print('\n'.join(sys.stdin.read().splitlines()[::-1]))
+  > EOF
   $ UPPERCASEPY="$TESTTMP/uppercase.py"
   $ cat > $UPPERCASEPY < import sys
@@ -1117,7 +1122,7 @@
   $ printf "first\nsecond\n" > bar.txt
   $ hg add -q
   $ hg fix -w --config fix.sometool:fileset=bar.txt \
-  >   --config fix.sometool:command=tac
+  >   --config fix.sometool:command="$PYTHON $TAC"
   the fix.tool:fileset config name is deprecated; please rename it to 
fix.tool:pattern
 
   $ cat foo.whole



To: durin42, #hg-reviewers, martinvonz
Cc: martinvonz, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5239: tests: replace `tac` reimplementation by `sort -r`

2018-11-07 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  `sort -r` is better code "formatter" than `tac` since it's
  stable. It's also portable so we don't need to reimplement it in
  Python.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5239

AFFECTED FILES
  tests/test-fix.t

CHANGE DETAILS

diff --git a/tests/test-fix.t b/tests/test-fix.t
--- a/tests/test-fix.t
+++ b/tests/test-fix.t
@@ -1,11 +1,6 @@
 A script that implements uppercasing of specific lines in a file. This
 approximates the behavior of code formatters well enough for our tests.
 
-  $ TAC="$TESTTMP/tac.py"
-  $ cat > $TAC < import sys
-  > print('\n'.join(sys.stdin.read().splitlines()[::-1]))
-  > EOF
   $ UPPERCASEPY="$TESTTMP/uppercase.py"
   $ cat > $UPPERCASEPY < import sys
@@ -1122,7 +1117,7 @@
   $ printf "first\nsecond\n" > bar.txt
   $ hg add -q
   $ hg fix -w --config fix.sometool:fileset=bar.txt \
-  >   --config fix.sometool:command="$PYTHON $TAC"
+  >   --config fix.sometool:command="sort -r"
   the fix.tool:fileset config name is deprecated; please rename it to 
fix.tool:pattern
 
   $ cat foo.whole



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


D5238: tests: work around `tac` not being portable

2018-11-07 Thread martinvonz (Martin von Zweigbergk)
martinvonz accepted this revision.
martinvonz added inline comments.
This revision is now accepted and ready to land.

INLINE COMMENTS

> durin42 wrote in test-fix.t:1125
> It probably could, but I don't feel strongly either way. Do you?

Not very, but strongly enough that'd I've tested that the test passes. I can 
queue this and send a followup.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5238

To: durin42, #hg-reviewers, martinvonz
Cc: martinvonz, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5238: tests: work around `tac` not being portable

2018-11-07 Thread durin42 (Augie Fackler)
durin42 added inline comments.

INLINE COMMENTS

> martinvonz wrote in test-fix.t:1125
> Could the tool be `sort -r`? I know that's not generally equivalent to `tac`, 
> but it seems like it might work here (it's kind of a reasonable fix tool too).

It probably could, but I don't feel strongly either way. Do you?

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5238

To: durin42, #hg-reviewers
Cc: martinvonz, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5238: tests: work around `tac` not being portable

2018-11-07 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> test-fix.t:1125
>$ hg fix -w --config fix.sometool:fileset=bar.txt \
> -  >   --config fix.sometool:command=tac
> +  >   --config fix.sometool:command="$PYTHON $TAC"
>the fix.tool:fileset config name is deprecated; please rename it to 
> fix.tool:pattern

Could the tool be `sort -r`? I know that's not generally equivalent to `tac`, 
but it seems like it might work here (it's kind of a reasonable fix tool too).

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5238

To: durin42, #hg-reviewers
Cc: martinvonz, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5238: tests: work around `tac` not being portable

2018-11-07 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Introduce a tac.py helper and use it. Sigh.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5238

AFFECTED FILES
  tests/test-fix.t

CHANGE DETAILS

diff --git a/tests/test-fix.t b/tests/test-fix.t
--- a/tests/test-fix.t
+++ b/tests/test-fix.t
@@ -1,6 +1,11 @@
 A script that implements uppercasing of specific lines in a file. This
 approximates the behavior of code formatters well enough for our tests.
 
+  $ TAC="$TESTTMP/tac.py"
+  $ cat > $TAC < import sys
+  > print('\n'.join(sys.stdin.read().splitlines()[::-1]))
+  > EOF
   $ UPPERCASEPY="$TESTTMP/uppercase.py"
   $ cat > $UPPERCASEPY < import sys
@@ -1117,7 +1122,7 @@
   $ printf "first\nsecond\n" > bar.txt
   $ hg add -q
   $ hg fix -w --config fix.sometool:fileset=bar.txt \
-  >   --config fix.sometool:command=tac
+  >   --config fix.sometool:command="$PYTHON $TAC"
   the fix.tool:fileset config name is deprecated; please rename it to 
fix.tool:pattern
 
   $ cat foo.whole



To: durin42, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5235: revlog: replace PyInt_AS_LONG with a more portable helper function

2018-11-07 Thread yuja (Yuya Nishihara)
yuja added a comment.


  > +/* Convert a PyInt or PyLong to a long. Returns false if there is an
  >  +   error, in which case an exception will already have been set. */
  >  +static inline bool pylong_to_long(PyObject *pylong, long *out)
  
  Nit: I prefer 0/-1 return value instead of bool since that's the convention
  of CPython API.
  
  > +   *out = PyLong_AsLong(pylong);
  >  +  return PyErr_Occurred() == NULL;
  
  Perhaps, checking `*out != -1` can be a fast path, though I don't know how
  much we care about the performance here.
  
  >   static int rustla_contains(rustlazyancestorsObject *self, PyObject *rev)
  >   {
  > 
  > - if (!(PyInt_Check(rev))) { +  long lrev; +if 
(!pylong_to_long(rev, )) {  return 0;
  
  Needs `PyErr_Clear() since `non_int in self` isn't an error.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5235

To: durin42, #hg-reviewers
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: D5235: revlog: replace PyInt_AS_LONG with a more portable helper function

2018-11-07 Thread Yuya Nishihara
> +/* Convert a PyInt or PyLong to a long. Returns false if there is an
> +   error, in which case an exception will already have been set. */
> +static inline bool pylong_to_long(PyObject *pylong, long *out)

Nit: I prefer 0/-1 return value instead of bool since that's the convention
of CPython API.

> + *out = PyLong_AsLong(pylong);
> + return PyErr_Occurred() == NULL;

Perhaps, checking `*out != -1` can be a fast path, though I don't know how
much we care about the performance here.

>  static int rustla_contains(rustlazyancestorsObject *self, PyObject *rev)
>  {
> - if (!(PyInt_Check(rev))) {
> + long lrev;
> + if (!pylong_to_long(rev, )) {
>   return 0;

Needs `PyErr_Clear() since `non_int in self` isn't an error.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5237: fix: add suboption for configuring execution order of tools

2018-11-07 Thread yuja (Yuya Nishihara)
yuja added a comment.


  > +  When multiple tools are configured to affect a file, they execute in an 
order
  >  +  defined by the :priority suboption. The priority suboption has a 
default value
  >  +  of zero for each tool. Tools are executed in order of ascending 
priority.
  
  Appears that we use "descending" priority in hooks and merge-tools. Let's
  follow these. Other than that, the patch looks good to me.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5237

To: hooper, #hg-reviewers
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: D5237: fix: add suboption for configuring execution order of tools

2018-11-07 Thread Yuya Nishihara
> +  When multiple tools are configured to affect a file, they execute in an 
> order
> +  defined by the :priority suboption. The priority suboption has a default 
> value
> +  of zero for each tool. Tools are executed in order of ascending priority.

Appears that we use "descending" priority in hooks and merge-tools. Let's
follow these. Other than that, the patch looks good to me.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5234: revlog: give formatting to clang-format

2018-11-07 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGe5ad3ef90aa1: revlog: give formatting to clang-format 
(authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5234?vs=12457=12464

REVISION DETAIL
  https://phab.mercurial-scm.org/D5234

AFFECTED FILES
  contrib/clang-format-ignorelist
  mercurial/cext/revlog.c

CHANGE DETAILS

diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c
--- a/mercurial/cext/revlog.c
+++ b/mercurial/cext/revlog.c
@@ -44,15 +44,15 @@
 typedef struct {
indexObject *index;
nodetreenode *nodes;
-   unsigned length; /* # nodes in use */
-   unsigned capacity;   /* # nodes allocated */
-   int depth;   /* maximum depth of tree */
-   int splits;  /* # splits performed */
+   unsigned length;   /* # nodes in use */
+   unsigned capacity; /* # nodes allocated */
+   int depth; /* maximum depth of tree */
+   int splits;/* # splits performed */
 } nodetree;
 
 typedef struct {
PyObject_HEAD /* ; */
-   nodetree nt;
+   nodetree nt;
 } nodetreeObject;
 
 /*
@@ -69,21 +69,21 @@
  */
 struct indexObjectStruct {
PyObject_HEAD
-   /* Type-specific fields go here. */
-   PyObject *data;/* raw bytes of index */
-   Py_buffer buf; /* buffer of data */
-   PyObject **cache;  /* cached tuples */
-   const char **offsets;  /* populated on demand */
-   Py_ssize_t raw_length; /* original number of elements */
-   Py_ssize_t length; /* current number of elements */
-   PyObject *added;   /* populated on demand */
-   PyObject *headrevs;/* cache, invalidated on changes */
-   PyObject *filteredrevs;/* filtered revs set */
-   nodetree nt;   /* base-16 trie */
-   int ntinitialized; /* 0 or 1 */
-   int ntrev; /* last rev scanned */
-   int ntlookups; /* # lookups */
-   int ntmisses;  /* # lookups that miss the cache */
+   /* Type-specific fields go here. */
+   PyObject *data; /* raw bytes of index */
+   Py_buffer buf;  /* buffer of data */
+   PyObject **cache;   /* cached tuples */
+   const char **offsets;   /* populated on demand */
+   Py_ssize_t raw_length;  /* original number of elements */
+   Py_ssize_t length;  /* current number of elements */
+   PyObject *added;/* populated on demand */
+   PyObject *headrevs; /* cache, invalidated on changes */
+   PyObject *filteredrevs; /* filtered revs set */
+   nodetree nt;/* base-16 trie */
+   int ntinitialized;  /* 0 or 1 */
+   int ntrev;  /* last rev scanned */
+   int ntlookups;  /* # lookups */
+   int ntmisses;   /* # lookups that miss the cache */
int inlined;
 };
 
@@ -126,7 +126,7 @@
errclass = PyDict_GetItemString(dict, "RevlogError");
if (errclass == NULL) {
PyErr_SetString(PyExc_SystemError,
-   "could not find RevlogError");
+   "could not find RevlogError");
goto cleanup;
}
 
@@ -146,7 +146,7 @@
if (self->inlined && pos > 0) {
if (self->offsets == NULL) {
self->offsets = PyMem_Malloc(self->raw_length *
-sizeof(*self->offsets));
+sizeof(*self->offsets));
if (self->offsets == NULL)
return (const char *)PyErr_NoMemory();
inline_scan(self, self->offsets);
@@ -157,11 +157,12 @@
return (const char *)(self->buf.buf) + pos * v1_hdrsize;
 }
 
-static inline int index_get_parents(indexObject *self, Py_ssize_t rev,
-   int *ps, int maxrev)
+static inline int index_get_parents(indexObject *self, Py_ssize_t rev, int *ps,
+int maxrev)
 {
if (rev >= self->length) {
-   PyObject *tuple = PyList_GET_ITEM(self->added, rev - 
self->length);
+   PyObject *tuple =
+   PyList_GET_ITEM(self->added, rev - self->length);
ps[0] = (int)PyInt_AS_LONG(PyTuple_GET_ITEM(tuple, 5));
ps[1] = (int)PyInt_AS_LONG(PyTuple_GET_ITEM(tuple, 6));
} else {
@@ -178,7 +179,6 @@
return 0;
 }
 
-
 /*
  * RevlogNG format (all in big endian, data may be inlined):
  *6 bytes: offset
@@ -248,9 +248,9 @@
parent_2 = getbe32(data + 28);
c_node_id = data + 32;
 
-   entry = Py_BuildValue(tuple_format, offset_flags, comp_len,
- uncomp_len, base_rev, link_rev,
- parent_1, parent_2, c_node_id, 

D5233: revlog: add blank line in comment to help clang-format

2018-11-07 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG5c14bf0c5be3: revlog: add blank line in comment to help 
clang-format (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5233?vs=12456=12465

REVISION DETAIL
  https://phab.mercurial-scm.org/D5233

AFFECTED FILES
  mercurial/cext/revlog.c

CHANGE DETAILS

diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c
--- a/mercurial/cext/revlog.c
+++ b/mercurial/cext/revlog.c
@@ -508,6 +508,7 @@
 
/* Internal data structure:
 * tovisit: array of length len+1 (all revs + nullrev), filled upto 
lentovisit
+*
 * revstates: array of length len+1 (all revs + nullrev) */
int *tovisit = NULL;
long lentovisit = 0;



To: durin42, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5232: revlog: add a comment to help clang-format produce less-awful results

2018-11-07 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG8c1f36bf2d3e: revlog: add a comment to help clang-format 
produce less-awful results (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5232?vs=12455=12462

REVISION DETAIL
  https://phab.mercurial-scm.org/D5232

AFFECTED FILES
  mercurial/cext/revlog.c

CHANGE DETAILS

diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c
--- a/mercurial/cext/revlog.c
+++ b/mercurial/cext/revlog.c
@@ -51,7 +51,7 @@
 } nodetree;
 
 typedef struct {
-   PyObject_HEAD
+   PyObject_HEAD /* ; */
nodetree nt;
 } nodetreeObject;
 



To: durin42, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5236: py3: ratchet caught two more passing tests

2018-11-07 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG26bab5c03e4c: py3: ratchet caught two more passing tests 
(authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5236?vs=12459=12463

REVISION DETAIL
  https://phab.mercurial-scm.org/D5236

AFFECTED FILES
  contrib/python3-whitelist

CHANGE DETAILS

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -193,6 +193,7 @@
 test-export.t
 test-extdata.t
 test-extdiff.t
+test-extension-timing.t
 test-extensions-afterloaded.t
 test-extensions-wrapfunction.py
 test-extra-filelog-entry.t
@@ -217,6 +218,7 @@
 test-graft.t
 test-grep.t
 test-hardlinks.t
+test-help-hide.t
 test-help.t
 test-hg-parseurl.py
 test-hghave.t



To: durin42, pulkit, #hg-reviewers
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 9 V3] perf: introduce a perfrevlogwrite command

2018-11-07 Thread Yuya Nishihara
On Tue, 06 Nov 2018 12:27:29 +0100, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld 
> # Date 1538556809 -7200
> #  Wed Oct 03 10:53:29 2018 +0200
> # Node ID 1d1bc06187e9296430045aa39c3d3e2d12f61875
> # Parent  909c31805f54628ab5bf22cd92418c8ac9c09277
> # EXP-Topic revlog-perf
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
> 1d1bc06187e9
> perf: introduce a perfrevlogwrite command

Queued, thanks.

Can you add some tests as a follow up? This hooks into various revlog
internals, which will be likely to break by API change. Also, the current
code wouldn't work on Python 3.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel