Re: [PATCH 05 of 11 V2] templatekw: introduce obsfate keyword

2017-10-13 Thread Yuya Nishihara
On Fri, 13 Oct 2017 20:00:32 +0200, Boris Feld wrote:
> On Thu, 2017-10-12 at 22:51 +0900, Yuya Nishihara wrote:
> > On Thu, 12 Oct 2017 15:29:31 +0200, Boris Feld wrote:
> > > On Wed, 2017-10-11 at 22:24 +0900, Yuya Nishihara wrote:
> > > > Ugh, there's templatekw.defaulttempl which provides the default
> > > > template
> > > > fragments to all stock/user templates. Maybe we can (ab)use it to
> > > > define
> > > > the default '{obsfate}' template.
> > > > 
> > > > I'm so sorry I didn't mention it before. It totally slipped my
> > > > mind.
> > > 
> > > I saw templatekw.defaulttempl when working in this series but it
> > > felt
> > > like a big hack.
> > > 
> > > I tried to limit the number of places where obsfate is defined,
> > > this
> > > series already adds two obsfate definitions/implementations, the
> > > changeset_printer and lobsfate in the default mapfile. I thought
> > > adding
> > > a third one in defaulttempl would complicate the potential update
> > > of
> > > obsfate output format.
> > > 
> > > I'm not an expert in the template engine, what benefits do you see
> > > in
> > > putting the obsfate definition in templatekw.defaulttempl?
> > 
> > That's more close to the end goal, right? We started off with a
> > couple of
> > building blocks to define {obsfate} in user template, because we
> > don't want
> > a monolithic {obsfate} keyword.
> > 
> > It would be nice if we could add "obsfate" to map-cmdline.default,
> > which
> > is the right way to define log templates, but IIRC you said you also
> > wanted
> > to reuse it in any user templates. So using defaulttempl seemed less
> > bad.
> 
> I thought that keywords defined in map-cmdline.default were not
> available in user-defined templates, I need to check that.

map-cmdline.default is not, but defaulttempl is. You need to %include a
map file to share some bits.

> One thing that I would like is for the default obsfate templatekw to be
> verbosity dependent, both in changing the fields that are shown (no
> date except in verbose mode) and the content of the fields themselves
> (if current user is the only one that touched a changeset and not in
> verbose mode, don't show users).
> 
> Is it possible to have this verbosity dependent logic with templates?

Maybe we can add {verbosity} keyword which returns ''/quiet/verbose/debug.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 4] test-audit-path: fill in missing output for no-symlink case

2017-10-13 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1507954046 14400
#  Sat Oct 14 00:07:26 2017 -0400
# Node ID e1a7c125f4ac198ba0ec72d9c378a8a357862799
# Parent  16d73491416b8db667296526740fed2af086452b
test-audit-path: fill in missing output for no-symlink case

It looks like this was meant to go with 989e884d1be9.

diff --git a/tests/test-audit-path.t b/tests/test-audit-path.t
--- a/tests/test-audit-path.t
+++ b/tests/test-audit-path.t
@@ -110,6 +110,7 @@
 #else
 ('back' will be a file and cause some other system specific error)
   $ hg update -Cr2
+  back: is both a file and a directory
   abort: * (glob)
   [255]
 #endif
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 3 of 4] test-conflicts: conditionalize for no-symlink platforms

2017-10-13 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1507957679 14400
#  Sat Oct 14 01:07:59 2017 -0400
# Node ID a154d01373b495122cf6ee17dd90ee600b8d4f41
# Parent  60c022679230b586511ec1c7ebc350dbd16e99f0
test-conflicts: conditionalize for no-symlink platforms

It seems better to create standin files for the symlinks, rather than blacklist
the entire tests.  Especially since link vs file doesn't seem to affect the
tests.

There is more instability in test-pathconflicts-{basic,merge}.t that I can't
figure out.

diff --git a/tests/test-origbackup-conflict.t b/tests/test-origbackup-conflict.t
--- a/tests/test-origbackup-conflict.t
+++ b/tests/test-origbackup-conflict.t
@@ -75,13 +75,19 @@
 
   $ hg up -q 0
   $ mkdir ../sym-link-target
+#if symlink
   $ ln -s ../../../sym-link-target b
+#else
+  $ touch b
+#endif
   $ hg up b1
   b: replacing untracked file
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (activating bookmark b1)
+#if symlink
   $ readlink.py .hg/origbackups/b
   .hg/origbackups/b -> ../../../sym-link-target
+#endif
 
 Perform an update that causes b/c to be backed up again - it should not go 
into the target dir
 
@@ -111,7 +117,8 @@
   b/c: replacing untracked file
   getting b/c
   creating directory: $TESTTMP/repo/.hg/badorigbackups/b
-  abort: Not a directory: '$TESTTMP/repo/.hg/badorigbackups/b'
+  abort: The system cannot find the path specified: 
'$TESTTMP/repo/.hg/badorigbackups/b' (glob) (windows !)
+  abort: Not a directory: '$TESTTMP/repo/.hg/badorigbackups/b' (no-windows !)
   [255]
   $ cat .hg/badorigbackups
   data
diff --git a/tests/test-pathconflicts-update.t 
b/tests/test-pathconflicts-update.t
--- a/tests/test-pathconflicts-update.t
+++ b/tests/test-pathconflicts-update.t
@@ -15,7 +15,11 @@
   $ hg up 0
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ mkdir a
+#if symlink
   $ ln -s c a/b
+#else
+  $ touch a/b
+#endif
   $ hg add a/b
   $ hg commit -m "link"
   created new head
@@ -50,7 +54,11 @@
 
   $ hg up -q 0
   $ mkdir a
+#if symlink
   $ ln -s x a/b
+#else
+  $ touch a/b
+#endif
   $ hg up dir
   a/b: untracked file conflicts with directory
   abort: untracked files in working directory differ from files in requested 
revision
@@ -59,8 +67,10 @@
   a/b: replacing untracked file
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (activating bookmark dir)
+#if symlink
   $ readlink.py a/b.orig
   a/b.orig -> x
+#endif
   $ rm a/b.orig
 
 Update - local directory conflicts with remote file
@@ -94,8 +104,10 @@
   a/b: replacing untracked files in directory
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (activating bookmark link)
+#if symlink
   $ readlink.py a/b
   a/b -> c
+#endif
   $ test -d a/b.orig
   $ rm -rf a/b.orig
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 4 of 4] tests: add globs for Windows

2017-10-13 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1507958412 14400
#  Sat Oct 14 01:20:12 2017 -0400
# Node ID 3f5ff923f62da10ca5695030abe31ee53d1a7b29
# Parent  a154d01373b495122cf6ee17dd90ee600b8d4f41
tests: add globs for Windows

diff --git a/tests/test-origbackup-conflict.t b/tests/test-origbackup-conflict.t
--- a/tests/test-origbackup-conflict.t
+++ b/tests/test-origbackup-conflict.t
@@ -29,7 +29,7 @@
   resolving manifests
   b/c: replacing untracked file
   getting b/c
-  creating directory: $TESTTMP/repo/.hg/origbackups/b
+  creating directory: $TESTTMP/repo/.hg/origbackups/b (glob)
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (activating bookmark c1)
   $ test -f .hg/origbackups/b/c
@@ -51,7 +51,7 @@
   resolving manifests
   b: replacing untracked file
   getting b
-  removing conflicting directory: $TESTTMP/repo/.hg/origbackups/b
+  removing conflicting directory: $TESTTMP/repo/.hg/origbackups/b (glob)
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (activating bookmark b1)
   $ test -f .hg/origbackups/b
@@ -65,8 +65,8 @@
   resolving manifests
   b/c: replacing untracked file
   getting b/c
-  creating directory: $TESTTMP/repo/.hg/origbackups/b
-  removing conflicting file: $TESTTMP/repo/.hg/origbackups/b
+  creating directory: $TESTTMP/repo/.hg/origbackups/b (glob)
+  removing conflicting file: $TESTTMP/repo/.hg/origbackups/b (glob)
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (activating bookmark c1)
   $ test -d .hg/origbackups/b
@@ -98,8 +98,8 @@
   resolving manifests
   b/c: replacing untracked file
   getting b/c
-  creating directory: $TESTTMP/repo/.hg/origbackups/b
-  removing conflicting file: $TESTTMP/repo/.hg/origbackups/b
+  creating directory: $TESTTMP/repo/.hg/origbackups/b (glob)
+  removing conflicting file: $TESTTMP/repo/.hg/origbackups/b (glob)
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (activating bookmark c1)
   $ cat .hg/origbackups/b/c
@@ -116,7 +116,7 @@
   resolving manifests
   b/c: replacing untracked file
   getting b/c
-  creating directory: $TESTTMP/repo/.hg/badorigbackups/b
+  creating directory: $TESTTMP/repo/.hg/badorigbackups/b (glob)
   abort: The system cannot find the path specified: 
'$TESTTMP/repo/.hg/badorigbackups/b' (glob) (windows !)
   abort: Not a directory: '$TESTTMP/repo/.hg/badorigbackups/b' (no-windows !)
   [255]
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 4] test-extdata: conditonalize error message for Windows

2017-10-13 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1507954859 14400
#  Sat Oct 14 00:20:59 2017 -0400
# Node ID 60c022679230b586511ec1c7ebc350dbd16e99f0
# Parent  e1a7c125f4ac198ba0ec72d9c378a8a357862799
test-extdata: conditonalize error message for Windows

diff --git a/tests/test-extdata.t b/tests/test-extdata.t
--- a/tests/test-extdata.t
+++ b/tests/test-extdata.t
@@ -88,7 +88,8 @@
   $ mkdir sub
   $ cd sub
   $ hg log -qr "extdata(filedata)"
-  abort: error: No such file or directory
+  abort: error: The system cannot find the file specified (windows !)
+  abort: error: No such file or directory (no-windows !)
   [255]
   $ hg log -qr "extdata(shelldata)"
   2:f6ed99a58333
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH v2] transaction-summary: show the range of new revisions upon pull/unbundle (BC)

2017-10-13 Thread Yuya Nishihara
On Thu, 12 Oct 2017 10:13:57 +0200, Denis Laxalde wrote:
> # HG changeset patch
> # User Denis Laxalde 
> # Date 1507793990 -7200
> #  Thu Oct 12 09:39:50 2017 +0200
> # Node ID 48cca33a1b611c82a2bd72a2f72b80f321604f42
> # Parent  f1c2552c2de78a2f8a0c0ded099ccb200aad27d0
> # Available At http://hg.logilab.org/users/dlaxalde/hg
> #  hg pull http://hg.logilab.org/users/dlaxalde/hg -r 48cca33a1b61
> # EXP-Topic pull-info-transaction
> transaction-summary: show the range of new revisions upon pull/unbundle (BC)

> +if txmatch(_reportnewcssource):
> +@reportsummary
> +def reportnewcs(repo, tr):
> +"""Report the range of new revisions pulled/unbundled."""
> +newrevs = list(tr.changes.get('revs', set()))
> +if not newrevs:
> +return
> +
> +# Compute the bounds of new revisions' range, excluding 
> obsoletes.
> +unfi = repo.unfiltered()
> +minrev, maxrev = None, None
> +newrevs.sort()
> +for r in newrevs:
> +if not unfi[r].obsolete():
> +minrev = repo[r]
> +break
> +for r in reversed(newrevs):
> +if not unfi[r].obsolete():
> +maxrev = repo[r]
> +break
> +
> +if minrev is None or maxrev is None:
> +# Got only obsoletes.
> +return

Perhpas revset can be used here.

  revs = unfi.revs('%ld and not obsolete()', newrevs)
  revs.min(), revs.max()
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D1056: context: add a fast-comparision path between arbitraryfilectx and workingfilectx

2017-10-13 Thread phillco (Phil Cohen)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG6036e6e205ca: context: add a fast-comparision for 
arbitraryfilectx and workingfilectx (authored by phillco, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1056?vs=2695=2719

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

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -8,6 +8,7 @@
 from __future__ import absolute_import
 
 import errno
+import filecmp
 import os
 import re
 import stat
@@ -2554,11 +2555,17 @@
 """Allows you to use filectx-like functions on a file in an arbitrary
 location on disk, possibly not in the working directory.
 """
-def __init__(self, path):
+def __init__(self, path, repo=None):
+# Repo is optional because contrib/simplemerge uses this class.
+self._repo = repo
 self._path = path
 
-def cmp(self, otherfilectx):
-return self.data() != otherfilectx.data()
+def cmp(self, fctx):
+if isinstance(fctx, workingfilectx) and self._repo:
+# Add a fast-path for merge if both sides are disk-backed.
+# Note that filecmp uses the opposite return values as cmp.
+return not filecmp.cmp(self.path(), self._repo.wjoin(fctx.path()))
+return self.data() != fctx.data()
 
 def path(self):
 return self._path



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


Re: [PATCH] test-i18n: guard gettext test appropriately

2017-10-13 Thread Augie Fackler
On Sat, Oct 14, 2017 at 01:55:05PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1507955834 -32400
> #  Sat Oct 14 13:37:14 2017 +0900
> # Node ID d70d56a43d2e301f605d2c2fe1368d04f0aaaf87
> # Parent  16d73491416b8db667296526740fed2af086452b
> test-i18n: guard gettext test appropriately

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


Re: [PATCH 2 of 5 V2] bookmark: add a dedicated txnclose-bookmark hook

2017-10-13 Thread Augie Fackler
On Wed, Oct 11, 2017 at 04:02:28PM +0200, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld 
> # Date 1507650822 -7200
> #  Tue Oct 10 17:53:42 2017 +0200
> # Node ID 03a0d02653cb1ab9957890f527144d1d0fed48b0
> # Parent  1a64b2bcd0209ea3b906f458818db6f29cebbcd7
> # EXP-Topic b2.phases.hooks
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
> 03a0d02653cb
> bookmark: add a dedicated txnclose-bookmark hook

[snip implementation which looks fine]

> diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t
> --- a/tests/test-bookmarks-pushpull.t
> +++ b/tests/test-bookmarks-pushpull.t
> @@ -7,6 +7,8 @@
>> publish=False
>> [experimental]
>> stabilization=createmarkers,exchange
> +  > [hooks]
> +  > txnclose-bookmark.test = echo "test-hook-bookmark: \$HG_BOOKMARK:  
> \$HG_OLDNODE -> \$HG_NODE"
>> EOF

It causes an annoying amount of test churn to have this hook on for
the entire file. Can we get adequate coverage by only doing this for a
few of the cases here rather than the entire file?

>  initialize
> @@ -20,14 +22,18 @@
>  set bookmarks
>
>$ hg bookmark X
> +  test-hook-bookmark: X:   -> 4e3505fd95835d721066b76e75dbb8cc554d7f77
>$ hg bookmark Y
> +  test-hook-bookmark: Y:   -> 4e3505fd95835d721066b76e75dbb8cc554d7f77
>$ hg bookmark Z
> +  test-hook-bookmark: Z:   -> 4e3505fd95835d721066b76e75dbb8cc554d7f77
>
>  import bookmark by name
>
>$ hg init ../b
>$ cd ../b
>$ hg book Y
> +  test-hook-bookmark: Y:   -> 
>$ hg book
> * Y -1:
>$ hg pull ../a
> @@ -40,6 +46,9 @@
>adding remote bookmark X
>updating bookmark Y
>adding remote bookmark Z
> +  test-hook-bookmark: X:   -> 4e3505fd95835d721066b76e75dbb8cc554d7f77
> +  test-hook-bookmark: Y:   -> 
> 4e3505fd95835d721066b76e75dbb8cc554d7f77
> +  test-hook-bookmark: Z:   -> 4e3505fd95835d721066b76e75dbb8cc554d7f77
>(run 'hg update' to get a working copy)
>$ hg bookmarks
>   X 0:4e3505fd9583
> @@ -58,10 +67,12 @@
>  delete the bookmark to re-pull it
>
>$ hg book -d X
> +  test-hook-bookmark: X:  4e3505fd95835d721066b76e75dbb8cc554d7f77 ->
>$ hg pull -B X ../a
>pulling from ../a
>no changes found
>adding remote bookmark X
> +  test-hook-bookmark: X:   -> 4e3505fd95835d721066b76e75dbb8cc554d7f77
>
>  finally no-op pull
>
> @@ -76,12 +87,16 @@
>  export bookmark by name
>
>$ hg bookmark W
> +  test-hook-bookmark: W:   -> 
>$ hg bookmark foo
> +  test-hook-bookmark: foo:   -> 
>$ hg bookmark foobar
> +  test-hook-bookmark: foobar:   -> 
>$ hg push -B W ../a
>pushing to ../a
>searching for changes
>no changes found
> +  test-hook-bookmark: W:   -> 
>exporting bookmark W
>[1]
>$ hg -R ../a bookmarks
> @@ -93,20 +108,24 @@
>  delete a remote bookmark
>
>$ hg book -d W
> +  test-hook-bookmark: W:   ->
>$ hg push -B W ../a
>pushing to ../a
>searching for changes
>no changes found
> +  test-hook-bookmark: W:   ->
>deleting remote bookmark W
>[1]
>
>  export the active bookmark
>
>$ hg bookmark V
> +  test-hook-bookmark: V:   -> 
>$ hg push -B . ../a
>pushing to ../a
>searching for changes
>no changes found
> +  test-hook-bookmark: V:   -> 
>exporting bookmark V
>[1]
>
> @@ -126,10 +145,12 @@
>  delete the bookmark
>
>$ hg book -d V
> +  test-hook-bookmark: V:   ->
>$ hg push -B V ../a
>pushing to ../a
>searching for changes
>no changes found
> +  test-hook-bookmark: V:   ->
>deleting remote bookmark V
>[1]
>$ hg up foobar
> @@ -155,8 +176,11 @@
>$ echo c1 > f1
>$ hg ci -Am1
>adding f1
> +  test-hook-bookmark: Z:  4e3505fd95835d721066b76e75dbb8cc554d7f77 -> 
> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
>$ hg book -f @
> +  test-hook-bookmark: @:   -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
>$ hg book -f X
> +  test-hook-bookmark: X:  4e3505fd95835d721066b76e75dbb8cc554d7f77 -> 
> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
>$ hg book
>   @ 1:0d2164f0ce0d
> * X 1:0d2164f0ce0d
> @@ -167,11 +191,15 @@
>$ hg up
>1 files updated, 0 files merged, 0 files removed, 0 files unresolved
>updating bookmark foobar
> +  test-hook-bookmark: foobar:   -> 
> 

Re: [PATCH 1 of 5 V2] hook: add a 'hashook' function to test for hook existence

2017-10-13 Thread Augie Fackler
On Wed, Oct 11, 2017 at 04:02:27PM +0200, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld 
> # Date 1507460911 -7200
> #  Sun Oct 08 13:08:31 2017 +0200
> # Node ID 1a64b2bcd0209ea3b906f458818db6f29cebbcd7
> # Parent  4a6a337f9c682bdf1659295f871dc43ff33677ca
> # EXP-Topic b2.phases.hooks
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
> 1a64b2bcd020
> hook: add a 'hashook' function to test for hook existence

queued, thanks

The rest of these have bitrotted. Could you rebase and resend them
(after seeing my comment on the next patch.) Thanks!
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 4 of 4 v3] log: add -L/--line-range option to follow file history by line range

2017-10-13 Thread Augie Fackler
(+jordigh, themystic, indygreg in case one of them has an opinion or 
inspiration)

> On Oct 13, 2017, at 10:24 AM, Yuya Nishihara  wrote:
> 
> On Fri, 13 Oct 2017 10:02:07 +0200, Denis Laxalde wrote:
>> Yuya Nishihara a écrit :
>>> On Tue, 10 Oct 2017 17:37:27 +0200, Denis Laxalde wrote:
 # HG changeset patch
 # User Denis Laxalde 
 # Date 1507290475 -7200
 #  Fri Oct 06 13:47:55 2017 +0200
 # Node ID a05d3b45319a9ec28205f19dd7012b206a2b200f
 # Parent  86a055d1c06f55daeb5d725187b61522974d24e3
 # Available At http://hg.logilab.org/users/dlaxalde/hg
 #  hg pull http://hg.logilab.org/users/dlaxalde/hg -r 
 a05d3b45319a
 # EXP-Topic followlines-cli/v2
 log: add -L/--line-range option to follow file history by line range
>>> 
>>> The series generally looks good to me in functionality POV. Some nits 
>>> follow.
>> 
>> Nits addressed in v4 which I can send now or once we agree on the UI.
>> 
>>> 
>>> So, do we really like this UI?
>> 
>> For the record, there are currently two proposals:
>> 
>> 1. The one implemented in this patch that adds a -L option to specify
>>both the file and its line range:
>> 
>>  hg log -L file.c,13-23 -L main.c,2-6
>> 
>> 2. The idea by Yuya to have pairs of -L FROMLINE-TOLINE options and
>>regular FILE arguments
>> 
>>  hg log -L 13-23 file.c -L 2-6 main.c
>> 
>>The issue with this one (as explained in [1]) is that option parsing
>>would not be strict, meaning that (IIUC) we would allow:
>> 
>>  hg log -L 13-23 -L 2-6 file.c main.c
>> 
>>to work the same as the previous example.
> 
> Thanks for the great summary. Some other crazy proposals just came up:
> 
> 3. Extend the fileset syntax
> 
>  hg log set:file.c@13-23 set:main.c@2-6
> 
>but we have to always type 'set:'
> 
> 4. Reuse the matcher kind to carry linerange in pats
> 
>  hg log file.c L:13-23 main.c L:2-6
> 
>linerange: and L: are preprocessed to be paired with the previous file
>pattern.
> 
> Another UI concern is whether --follow should be implied or required:
> 
>  hg log -L file.c,13-23  (implies --follow)
> 
> or
> 
>  hg log -L file.c,13-23  (abort)
>  hg log --follow -L file.c,13-23
> 
> If we take the latter, a plain file pattern can be used to select all lines.
> 
>  hg log --follow -L file.c,13-23 main.c

I feel like the -L file.c,13-23 is the least ambiguous option in terms of 
understanding what a command *does*, and probably also the easiest to actually 
implement with our command line parser. The others feel clever in a way that 
kind of makes me nervous.

I guess that’s to say, +0 on that version, and I think my second choice is the 
fileset syntax option? None of these enthuse me, but I’d be enthusiastic about 
landing the feature *somehow*. I’m hesitant to not ship this series with 4.4, 
as it seems like this is just complicated enough we’ll have to do something 
that’s a compromise no matter what to make it work on the command line.



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


D937: remotenames: move function to pull remotenames from the remoterepo to core

2017-10-13 Thread durin42 (Augie Fackler)
durin42 added a comment.


  Could we try and get this series ready to land before the freeze on 
Wednesday? or should we be aiming to get this early in the 4.5 cycle?

REPOSITORY
  rHG Mercurial

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

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


Re: [POLL] Mass renaming options for consistency + guidelines

2017-10-13 Thread Yuya Nishihara
On Sat, 14 Oct 2017 00:41:04 -0400, Augie Fackler wrote:
> > On Oct 14, 2017, at 12:38 AM, Martin von Zweigbergk  
> > wrote:
> > On Fri, Oct 13, 2017 at 9:33 PM, Augie Fackler  wrote:
> > > On Jul 19, 2017, at 10:14 AM, Augie Fackler  wrote:
> > >> On Jul 19, 2017, at 09:11, Yuya Nishihara  wrote:
> > >>
> >  I prefer not doing mass renaming that would generate lots of 
> >  "deprecated"
> >  config names in use around user hgrc and web documents. But if I had to
> >  choose one, I would vote for dashes/hyphens.
> > >>>
> > >>> We could also do what gmail does with email addresses and periods:
> > >>> they allow extra periods anywhere (I think). So allowpull and
> > >>> allow-pull and all-owpull would be all be the same config option. Just
> > >>> a thought; I'm not sure what I think.
> > >>
> > >> I'm not a fan of ambiguating identifiers. It smells like 
> > >> case-insensitive fs,
> > >> computer language, etc. that do sometimes surprising.
> > >
> > > Agreed. I had previously proposed exactly this, but in the intervening 
> > > years I've come to agree with Yuya that it's likely to be more confusing 
> > > than anything in the long run.
> > 
> > So, in reviewing https://phab.mercurial-scm.org/D932, it was noted that 
> > https://www.mercurial-scm.org/wiki/UIGuideline?action=diff=10=11 
> > concluded that there was a decision, but I don’t see any kind of consensus 
> > on this thread. Are we comfortable with this as the guidance going forward?
> > 
> > I am, but I wanted to make sure there’s some well-documented consensus of 
> > the policy change.
> > 
> > Me too. Hyphen-separated words sounds good (just repeating that here to 
> > clarify that that is the decision we're talking about).
> 
> Yep, that’s the one. Right now, my understanding of positions on 
> hyphen-separated-words is as follows:
> 
> durin42: +1
> martinvonz: +1
> David Demelier: +1
> Yuya: ? (I think +0 on hyphens at least for new config knobs?)

Yep, +0. More precisely:

 * okay: allow_pull
 * preferred: allow-pull
 * also preferred: allowpull

FWIW, dashes can't be used in some config sections.

 * [hooks] - pre-/post- is reserved for command hooks
 * [revsetaliases], [templatealiases] - name must be a valid symbol
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D613: dispatch: store the command name which is going to run in ui object

2017-10-13 Thread durin42 (Augie Fackler)
durin42 abandoned this revision.
durin42 added a comment.


  My understanding is that we're moving towards a marker in the command 
registrar to decide what repo filter to use, which seems cleaner. Please reopen 
this (and commandeer it if needed) if I'm wrong. Thanks!

REPOSITORY
  rHG Mercurial

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

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


D761: test: backout update evolution config

2017-10-13 Thread durin42 (Augie Fackler)
durin42 added a comment.


  In https://phab.mercurial-scm.org/D761#13848, @lothiraldan wrote:
  
  > @durin42 Good for me, I don't have strong opinion on the matter. I will 
have a patch ready for the sprint.
  
  
  What's the story with this revision? Should we close it and 
https://phab.mercurial-scm.org/D762? Or do we have some revised versions I 
should look at?

REPOSITORY
  rHG Mercurial

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

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


D728: rebase: move working parent movement logic to scmutil.cleanupnodes

2017-10-13 Thread durin42 (Augie Fackler)
durin42 added a comment.


  Let's reopen this if/when we return to it.

REPOSITORY
  rHG Mercurial

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

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


D98: revset: support reading aliases from a .hgrevsets file

2017-10-13 Thread durin42 (Augie Fackler)
durin42 abandoned this revision.
durin42 added a comment.


  Let's reopen this if/when we return to it.

REPOSITORY
  rHG Mercurial

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

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


D588: win32: use fewer system calls for unlink()

2017-10-13 Thread durin42 (Augie Fackler)
durin42 abandoned this revision.
durin42 added a comment.


  Let's reopen this if/when we return to it.

REPOSITORY
  rHG Mercurial

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

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


D587: copytrace: add `hg help copytrace`

2017-10-13 Thread durin42 (Augie Fackler)
durin42 abandoned this revision.
durin42 added a comment.


  Let's reopen this if/when we return to it.

REPOSITORY
  rHG Mercurial

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

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


D985: tersestatus: re-implement the functionality to terse the status

2017-10-13 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG7e3001b74ab3: tersestatus: re-implement the functionality 
to terse the status (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D985?vs=2645=2716

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/commands.py

CHANGE DETAILS

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4805,12 +4805,18 @@
 show = states[:5]
 
 m = scmutil.match(repo[node2], pats, opts)
-stat = repo.status(node1, node2, m,
-   'ignored' in show, 'clean' in show, 'unknown' in show,
-   opts.get('subrepos'))
 if terse:
-stat = cmdutil.tersestatus(repo.root, stat, terse,
-repo.dirstate._ignore, opts.get('ignored'))
+# we need to compute clean and unknown to terse
+stat = repo.status(node1, node2, m,
+   'ignored' in show or 'i' in terse,
+True, True, opts.get('subrepos'))
+
+stat = cmdutil.tersedir(stat, terse)
+else:
+stat = repo.status(node1, node2, m,
+   'ignored' in show, 'clean' in show,
+   'unknown' in show, opts.get('subrepos'))
+
 changestates = zip(states, pycompat.iterbytestr('MAR!?IC'), stat)
 
 if (opts.get('all') or opts.get('copies')
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -402,177 +402,169 @@
 
 return commit(ui, repo, recordinwlock, pats, opts)
 
-def tersestatus(root, statlist, status, ignorefn, ignore):
-"""
-Returns a list of statuses with directory collapsed if all the files in the
-directory has the same status.
+
+# extracted at module level as it's required each time a file will be added
+# to dirnode class object below
+pathsep = pycompat.ossep
+
+class dirnode(object):
 """
-
-def numfiles(dirname):
-"""
-Calculates the number of tracked files in a given directory which also
-includes files which were removed or deleted. Considers ignored files
-if ignore argument is True or 'i' is present in status argument.
+represents a directory in user working copy
+
+stores information which is required for purpose of tersing the status
+
+path is the path to the directory
+
+statuses is a set of statuses of all files in this directory (this includes
+all the files in all the subdirectories too)
+
+files is a list of files which are direct child of this directory
+
+subdirs is a dictionary of sub-directory name as the key and it's own
+dirnode object as the value
+"""
+
+def __init__(self, dirpath):
+self.path = dirpath
+self.statuses = set([])
+self.files = []
+self.subdirs = {}
+
+def _addfileindir(self, filename, status):
+""" adds a file in this directory as the direct child """
+self.files.append((filename, status))
+
+def addfile(self, filename, status):
 """
-if lencache.get(dirname):
-return lencache[dirname]
-if 'i' in status or ignore:
-def match(localpath):
-absolutepath = os.path.join(root, localpath)
-if os.path.isdir(absolutepath) and isemptydir(absolutepath):
-return True
-return False
-else:
-def match(localpath):
-# there can be directory whose all the files are ignored and
-# hence the drectory should also be ignored while counting
-# number of files or subdirs in it's parent directory. This
-# checks the same.
-# XXX: We need a better logic here.
-if os.path.isdir(os.path.join(root, localpath)):
-return isignoreddir(localpath)
-else:
-# XXX: there can be files which have the ignored pattern 
but
-# are not ignored. That leads to bug in counting number of
-# tracked files in the directory.
-return ignorefn(localpath)
-lendir = 0
-abspath = os.path.join(root, dirname)
-# There might be cases when a directory does not exists as the whole
-# directory can be removed and/or deleted.
-try:
-for f in os.listdir(abspath):
-localpath = os.path.join(dirname, f)
-if not match(localpath):
-lendir += 1
-except OSError:
-pass
-lendir += len(absentdir.get(dirname, []))
-lencache[dirname] = lendir
-return lendir
-
-def isemptydir(abspath):
-"""
-Check 

D1042: tersestatus: make methods part of the dirnode class

2017-10-13 Thread dlax (Denis Laxalde)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG3d6d4b12128e: tersestatus: make methods part of the dirnode 
class (authored by dlax, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1042?vs=2646=2717

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

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -462,59 +462,64 @@
 if status not in self.statuses:
 self.statuses.add(status)
 
-def _addfilestotersed(path, files, tersedict):
-""" adds files to the their respective status list in the final tersed list
-
-path is the path of parent directory of the file
-files is a list of tuple where each tuple is (filename, status)
-tersedict is a dictonary which contains each status abbreviation as key and
-list of files and tersed dirs in that status as value
-"""
-for f, st in files:
-tersedict[st].append(os.path.join(path, f))
-
-def _processtersestatus(subdir, tersedict, terseargs):
-"""a recursive function which process status for a certain directory.
-
-subdir is an oject of dirnode class defined below. each object of dirnode
-class has a set of statuses which files in that directory has. This ease 
our
-check whether we can terse that directory or not.
-
-tersedict is a dictonary which contains each status abbreviation as key and
-list of files and tersed dirs in that status as value. In each function 
call
-we are passing the same dict and adding files and dirs to it.
-
-terseargs is the string of arguments passed by the user with `--terse` 
flag.
-
-Following are the cases which can happen:
-
-1) All the files in the directory (including all the files in its
-subdirectories) share the same status and the user has asked us to terse
-that status. -> we add the directory name to status list and return
-
-2) If '1)' does not happen, we do following:
-
-a) Add all the files which are in this directory (only the ones in
-this directory, not the subdirs) to their respective status 
list
-
-b) Recurse the function on all the subdirectories of this directory
-"""
-
-if len(subdir.statuses) == 1:
-onlyst = subdir.statuses.pop()
-
-# Making sure we terse only when the status abbreviation is passed as
-# terse argument
-if onlyst in terseargs:
-tersedict[onlyst].append(subdir.path + pycompat.ossep)
-return
-
-# add the files to status list
-_addfilestotersed(subdir.path, subdir.files, tersedict)
-
-#recurse on the subdirs
-for dirobj in subdir.subdirs.values():
-_processtersestatus(dirobj, tersedict, terseargs)
+def _addfilestotersed(self, tersedict):
+"""
+adds files to the their respective status list in the final tersed list
+
+path is the path of parent directory of the file
+files is a list of tuple where each tuple is (filename, status)
+tersedict is a dictonary which contains each status abbreviation as 
key and
+list of files and tersed dirs in that status as value
+"""
+for f, st in self.files:
+tersedict[st].append(os.path.join(self.path, f))
+
+def _processtersestatus(self, tersedict, terseargs):
+"""
+a recursive function which process status for a certain directory.
+
+self is an oject of dirnode class defined below. each object of dirnode
+class has a set of statuses which files in that directory has. This 
ease
+our check whether we can terse that directory or not.
+
+tersedict is a dictonary which contains each status abbreviation as key
+and list of files and tersed dirs in that status as value. In each
+function call we are passing the same dict and adding files and dirs
+to it.
+
+terseargs is the string of arguments passed by the user with `--terse`
+flag.
+
+Following are the cases which can happen:
+
+1) All the files in the directory (including all the files in its
+subdirectories) share the same status and the user has asked us to 
terse
+that status. -> we add the directory name to status list and return
+
+2) If '1)' does not happen, we do following:
+
+a) Add all the files which are in this directory (only the 
ones in
+this directory, not the subdirs) to their respective 
status list
+
+b) Recurse the function on all the subdirectories of this
+   directory
+"""
+
+if len(self.statuses) == 1:
+onlyst = self.statuses.pop()
+
+# Making sure we terse only when the status abbreviation is
+# passed as terse argument
+   

D1043: tersestatus: avoid modifying tersedict

2017-10-13 Thread dlax (Denis Laxalde)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG5d98674df18a: tersestatus: avoid modifying tersedict 
(authored by dlax, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1043?vs=2647=2718

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

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -462,19 +462,17 @@
 if status not in self.statuses:
 self.statuses.add(status)
 
-def _addfilestotersed(self, tersedict):
+def iterfilepaths(self):
 """
 adds files to the their respective status list in the final tersed list
 
 path is the path of parent directory of the file
 files is a list of tuple where each tuple is (filename, status)
-tersedict is a dictonary which contains each status abbreviation as 
key and
-list of files and tersed dirs in that status as value
 """
 for f, st in self.files:
-tersedict[st].append(os.path.join(self.path, f))
-
-def _processtersestatus(self, tersedict, terseargs):
+yield st, os.path.join(self.path, f)
+
+def tersewalk(self, terseargs):
 """
 a recursive function which process status for a certain directory.
 
@@ -494,12 +492,12 @@
 
 1) All the files in the directory (including all the files in its
 subdirectories) share the same status and the user has asked us to 
terse
-that status. -> we add the directory name to status list and return
+that status. -> yield (status, dirpath)
 
 2) If '1)' does not happen, we do following:
 
-a) Add all the files which are in this directory (only the 
ones in
-this directory, not the subdirs) to their respective 
status list
+a) Yield (status, filepath)  for all the files which are in 
this
+directory (only the ones in this directory, not the 
subdirs)
 
 b) Recurse the function on all the subdirectories of this
directory
@@ -511,15 +509,17 @@
 # Making sure we terse only when the status abbreviation is
 # passed as terse argument
 if onlyst in terseargs:
-tersedict[onlyst].append(self.path + pycompat.ossep)
+yield onlyst, self.path + pycompat.ossep
 return
 
 # add the files to status list
-self._addfilestotersed(tersedict)
+for st, fpath in self.iterfilepaths():
+yield st, fpath
 
 #recurse on the subdirs
 for dirobj in self.subdirs.values():
-dirobj._processtersestatus(tersedict, terseargs)
+for st, fpath in dirobj.tersewalk(terseargs):
+yield st, fpath
 
 def tersedir(statuslist, terseargs):
 """
@@ -536,7 +536,7 @@
 
 tersedict (defined in the function) is a dictionary which has one word key
 for each status and a list of files and dir in that status as the 
respective
-value. The dictionary is passed to other helper functions which builds it.
+value.
 """
 # the order matters here as that is used to produce final list
 allst = ('m', 'a', 'r', 'd', 'u', 'i', 'c')
@@ -558,11 +558,13 @@
 tersedict[attrname[0]] = []
 
 # we won't be tersing the root dir, so add files in it
-rootobj._addfilestotersed(tersedict)
+for st, fpath in rootobj.iterfilepaths():
+tersedict[st].append(fpath)
 
 # process each sub-directory and build tersedict
 for subdir in rootobj.subdirs.values():
-subdir._processtersestatus(tersedict, terseargs)
+for st, f in subdir.tersewalk(terseargs):
+tersedict[st].append(f)
 
 tersedlist = []
 for st in allst:



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


D1061: context: add is `isinmemory()` to filectx

2017-10-13 Thread phillco (Phil Cohen)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG4dc8a2ee0f4f: context: add is `isinmemory()` to filectx 
(authored by phillco, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1061?vs=2700=2715

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

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -622,6 +622,9 @@
 def hidden(self):
 return self._rev in repoview.filterrevs(self._repo, 'visible')
 
+def isinmemory(self):
+return False
+
 def children(self):
 """return contexts for each child changeset"""
 c = self._repo.changelog.children(self._node)
@@ -1401,6 +1404,9 @@
 def extra(self):
 return self._extra
 
+def isinmemory(self):
+return False
+
 def tags(self):
 return []
 
@@ -1978,6 +1984,9 @@
 else:
 return self._wrappedctx[path].data()
 
+def isinmemory(self):
+return True
+
 def filedate(self, path):
 if self.isdirty(path):
 return self._cache[path]['date']



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


D931: merge: ensure that we always commit the mergestate

2017-10-13 Thread ryanmce (Ryan McElroy)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGc0a524f77e8a: merge: ensure that we always commit the 
mergestate (authored by ryanmce, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D931?vs=2500=2714

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

AFFECTED FILES
  mercurial/merge.py

CHANGE DETAILS

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1537,30 +1537,32 @@
 newactions.append((f, args, msg))
 mergeactions = newactions
 
-# premerge
-tocomplete = []
-for f, args, msg in mergeactions:
-repo.ui.debug(" %s: %s -> m (premerge)\n" % (f, msg))
-z += 1
-progress(_updating, z, item=f, total=numupdates, unit=_files)
-if f == '.hgsubstate': # subrepo states need updating
-subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx),
- overwrite, labels)
-continue
-wctx[f].audit()
-complete, r = ms.preresolve(f, wctx)
-if not complete:
-numupdates += 1
-tocomplete.append((f, args, msg))
+try:
+# premerge
+tocomplete = []
+for f, args, msg in mergeactions:
+repo.ui.debug(" %s: %s -> m (premerge)\n" % (f, msg))
+z += 1
+progress(_updating, z, item=f, total=numupdates, unit=_files)
+if f == '.hgsubstate': # subrepo states need updating
+subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx),
+ overwrite, labels)
+continue
+wctx[f].audit()
+complete, r = ms.preresolve(f, wctx)
+if not complete:
+numupdates += 1
+tocomplete.append((f, args, msg))
 
-# merge
-for f, args, msg in tocomplete:
-repo.ui.debug(" %s: %s -> m (merge)\n" % (f, msg))
-z += 1
-progress(_updating, z, item=f, total=numupdates, unit=_files)
-ms.resolve(f, wctx)
+# merge
+for f, args, msg in tocomplete:
+repo.ui.debug(" %s: %s -> m (merge)\n" % (f, msg))
+z += 1
+progress(_updating, z, item=f, total=numupdates, unit=_files)
+ms.resolve(f, wctx)
 
-ms.commit()
+finally:
+ms.commit()
 
 unresolved = ms.unresolvedcount()
 



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


D983: dirstate: move the _dirfoldmap to dirstatemap

2017-10-13 Thread durham (Durham Goode)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGe8a89ed7ce96: dirstate: move the _dirfoldmap to dirstatemap 
(authored by durham, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D983?vs=2513=2713

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

AFFECTED FILES
  contrib/perf.py
  mercurial/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -132,14 +132,6 @@
 self._read()
 return self._map
 
-@propertycache
-def _dirfoldmap(self):
-f = {}
-normcase = util.normcase
-for name in self._map.dirs:
-f[normcase(name)] = name
-return f
-
 @property
 def _sparsematcher(self):
 """The matcher for the sparse checkout.
@@ -372,8 +364,7 @@
 rereads the dirstate. Use localrepo.invalidatedirstate() if you want to
 check whether the dirstate has changed before rereading it.'''
 
-for a in ("_map", "_dirfoldmap", "_branch",
-  "_ignore"):
+for a in ("_map", "_branch", "_ignore"):
 if a in self.__dict__:
 delattr(self, a)
 self._lastnormaltime = 0
@@ -568,15 +559,15 @@
 normed = util.normcase(path)
 folded = self._map.filefoldmap.get(normed, None)
 if folded is None:
-folded = self._dirfoldmap.get(normed, None)
+folded = self._map.dirfoldmap.get(normed, None)
 if folded is None:
 if isknown:
 folded = path
 else:
 # store discovered result in dirfoldmap so that future
 # normalizefile calls don't start matching directories
 folded = self._discoverpath(path, normed, ignoremissing, 
exists,
-self._dirfoldmap)
+self._map.dirfoldmap)
 return folded
 
 def normalize(self, path, isknown=False, ignoremissing=False):
@@ -875,7 +866,7 @@
 if len(paths) > 1:
 for path in paths:
 folded = self._discoverpath(path, norm, True, None,
-self._dirfoldmap)
+self._map.dirfoldmap)
 if path != folded:
 results[path] = None
 
@@ -1396,3 +1387,10 @@
 self.read()
 return self.identity
 
+@propertycache
+def dirfoldmap(self):
+f = {}
+normcase = util.normcase
+for name in self.dirs:
+f[normcase(name)] = name
+return f
diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -560,8 +560,8 @@
 dirstate = repo.dirstate
 'a' in dirstate
 def d():
-dirstate._dirfoldmap.get('a')
-del dirstate._dirfoldmap
+dirstate._map.dirfoldmap.get('a')
+del dirstate._map.dirfoldmap
 del dirstate._map.dirs
 timer(d)
 fm.end()



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


[PATCH] test-i18n: guard gettext test appropriately

2017-10-13 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1507955834 -32400
#  Sat Oct 14 13:37:14 2017 +0900
# Node ID d70d56a43d2e301f605d2c2fe1368d04f0aaaf87
# Parent  16d73491416b8db667296526740fed2af086452b
test-i18n: guard gettext test appropriately

diff --git a/tests/test-i18n.t b/tests/test-i18n.t
--- a/tests/test-i18n.t
+++ b/tests/test-i18n.t
@@ -49,6 +49,8 @@ tool itself by doctest
   $ $PYTHON check-translation.py --doctest
   $ cd $TESTTMP
 
+#if gettext
+
 Check i18n cache isn't reused after encoding change:
 
   $ cat > $TESTTMP/encodingchange.py << EOF
@@ -68,3 +70,5 @@ Check i18n cache isn't reused after enco
   (\xe5\xae\x9f\xe9\xa8\x93\xe7\x9a\x84\xe5\xae\x9f\xe8\xa3\x85) (esc)
   (?)
   (\xe5\xae\x9f\xe9\xa8\x93\xe7\x9a\x84\xe5\xae\x9f\xe8\xa3\x85) (esc)
+
+#endif
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D981: dirstate: remove _filefoldmap property cache

2017-10-13 Thread durham (Durham Goode)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGbfddc3d678ae: dirstate: remove _filefoldmap property cache 
(authored by durham, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D981?vs=2511=2710

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

AFFECTED FILES
  contrib/perf.py
  mercurial/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -133,10 +133,6 @@
 return self._map
 
 @propertycache
-def _filefoldmap(self):
-return self._map.filefoldmap()
-
-@propertycache
 def _dirfoldmap(self):
 f = {}
 normcase = util.normcase
@@ -380,7 +376,7 @@
 rereads the dirstate. Use localrepo.invalidatedirstate() if you want to
 check whether the dirstate has changed before rereading it.'''
 
-for a in ("_map", "_filefoldmap", "_dirfoldmap", "_branch",
+for a in ("_map", "_dirfoldmap", "_branch",
   "_dirs", "_ignore"):
 if a in self.__dict__:
 delattr(self, a)
@@ -412,10 +408,10 @@
 if self[f] not in "?r" and "_dirs" in self.__dict__:
 self._dirs.delpath(f)
 
-if "_filefoldmap" in self.__dict__:
+if "filefoldmap" in self._map.__dict__:
 normed = util.normcase(f)
-if normed in self._filefoldmap:
-del self._filefoldmap[normed]
+if normed in self._map.filefoldmap:
+del self._map.filefoldmap[normed]
 
 self._updatedfiles.add(f)
 
@@ -563,18 +559,18 @@
 
 def _normalizefile(self, path, isknown, ignoremissing=False, exists=None):
 normed = util.normcase(path)
-folded = self._filefoldmap.get(normed, None)
+folded = self._map.filefoldmap.get(normed, None)
 if folded is None:
 if isknown:
 folded = path
 else:
 folded = self._discoverpath(path, normed, ignoremissing, 
exists,
-self._filefoldmap)
+self._map.filefoldmap)
 return folded
 
 def _normalize(self, path, isknown, ignoremissing=False, exists=None):
 normed = util.normcase(path)
-folded = self._filefoldmap.get(normed, None)
+folded = self._map.filefoldmap.get(normed, None)
 if folded is None:
 folded = self._dirfoldmap.get(normed, None)
 if folded is None:
@@ -1270,6 +1266,7 @@
 otherparent.add(fname)
 return nonnorm, otherparent
 
+@propertycache
 def filefoldmap(self):
 """Returns a dictionary mapping normalized case paths to their
 non-normalized versions.
diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -549,8 +549,8 @@
 dirstate = repo.dirstate
 'a' in dirstate
 def d():
-dirstate._filefoldmap.get('a')
-del dirstate._filefoldmap
+dirstate._map.filefoldmap.get('a')
+del dirstate._map.filefoldmap
 timer(d)
 fm.end()
 



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


D930: merge: add tests to show current behavior on failed filemerges

2017-10-13 Thread ryanmce (Ryan McElroy)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG143337bcec9b: merge: add tests to show current behavior on 
failed filemerges (authored by ryanmce, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D930?vs=2499=2712

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

AFFECTED FILES
  tests/test-merge-halt.t

CHANGE DETAILS

diff --git a/tests/test-merge-halt.t b/tests/test-merge-halt.t
new file mode 100644
--- /dev/null
+++ b/tests/test-merge-halt.t
@@ -0,0 +1,78 @@
+  $ cat >> $HGRCPATH < [extensions]
+  > rebase=
+  > [phases]
+  > publish=False
+  > [merge]
+  > EOF
+
+  $ hg init repo
+  $ cd repo
+  $ echo a > a
+  $ echo b > b
+  $ hg commit -qAm ab
+  $ echo c >> a
+  $ echo c >> b
+  $ hg commit -qAm c
+  $ hg up -q ".^"
+  $ echo d >> a
+  $ echo d >> b
+  $ hg commit -qAm d
+
+Testing on-failure=continue
+  $ echo on-failure=continue >> $HGRCPATH
+  $ hg rebase -s 1 -d 2 --tool false
+  rebasing 1:1f28a51c3c9b "c"
+  merging a
+  merging b
+  merging a failed!
+  merging b failed!
+  unresolved conflicts (see hg resolve, then hg rebase --continue)
+  [1]
+
+  $ hg resolve --list
+  U a
+  U b
+
+  $ hg rebase --abort
+  rebase aborted
+
+Testing on-failure=halt
+  $ echo on-failure=halt >> $HGRCPATH
+  $ hg rebase -s 1 -d 2 --tool false
+  rebasing 1:1f28a51c3c9b "c"
+  merging a
+  merging b
+  merging a failed!
+  merging b failed!
+  unresolved conflicts (see hg resolve, then hg rebase --continue)
+  [1]
+
+  $ hg resolve --list
+  U a
+  U b
+
+  $ hg rebase --abort
+  rebase aborted
+
+Testing on-failure=prompt
+  $ echo on-failure=prompt >> $HGRCPATH
+  $ cat < y
+  > n
+  > EOS
+  rebasing 1:1f28a51c3c9b "c"
+  merging a
+  merging b
+  merging a failed!
+  merging b failed!
+  unresolved conflicts (see hg resolve, then hg rebase --continue)
+  [1]
+
+  $ hg resolve --list
+  U a
+  U b
+
+  $ hg rebase --abort
+  rebase aborted
+



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


D982: dirstate: remove _dirs property cache

2017-10-13 Thread durham (Durham Goode)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG014bd2a555c8: dirstate: remove _dirs property cache 
(authored by durham, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D982?vs=2512=2711

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

AFFECTED FILES
  contrib/perf.py
  mercurial/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -136,7 +136,7 @@
 def _dirfoldmap(self):
 f = {}
 normcase = util.normcase
-for name in self._dirs:
+for name in self._map.dirs:
 f[normcase(name)] = name
 return f
 
@@ -166,12 +166,8 @@
 def _pl(self):
 return self._map.parents()
 
-@propertycache
-def _dirs(self):
-return self._map.dirs()
-
 def dirs(self):
-return self._dirs
+return self._map.dirs
 
 @rootcache('.hgignore')
 def _ignore(self):
@@ -377,7 +373,7 @@
 check whether the dirstate has changed before rereading it.'''
 
 for a in ("_map", "_dirfoldmap", "_branch",
-  "_dirs", "_ignore"):
+  "_ignore"):
 if a in self.__dict__:
 delattr(self, a)
 self._lastnormaltime = 0
@@ -405,8 +401,8 @@
 return self._map.copymap
 
 def _droppath(self, f):
-if self[f] not in "?r" and "_dirs" in self.__dict__:
-self._dirs.delpath(f)
+if self[f] not in "?r" and "dirs" in self._map.__dict__:
+self._map.dirs.delpath(f)
 
 if "filefoldmap" in self._map.__dict__:
 normed = util.normcase(f)
@@ -419,18 +415,18 @@
 oldstate = self[f]
 if state == 'a' or oldstate == 'r':
 scmutil.checkfilename(f)
-if f in self._dirs:
+if f in self._map.dirs:
 raise error.Abort(_('directory %r already in dirstate') % f)
 # shadows
 for d in util.finddirs(f):
-if d in self._dirs:
+if d in self._map.dirs:
 break
 entry = self._map.get(d)
 if entry is not None and entry[0] != 'r':
 raise error.Abort(
 _('file %r in dirstate clashes with %r') % (d, f))
-if oldstate in "?r" and "_dirs" in self.__dict__:
-self._dirs.addpath(f)
+if oldstate in "?r" and "dirs" in self._map.__dict__:
+self._map.dirs.addpath(f)
 self._dirty = True
 self._updatedfiles.add(f)
 self._map[f] = dirstatetuple(state, mode, size, mtime)
@@ -607,8 +603,6 @@
 
 def clear(self):
 self._map = dirstatemap(self._ui, self._opener, self._root)
-if "_dirs" in self.__dict__:
-delattr(self, "_dirs")
 self._map.setparents(nullid, nullid)
 self._lastnormaltime = 0
 self._updatedfiles.clear()
@@ -1287,6 +1281,7 @@
 f['.'] = '.' # prevents useless util.fspath() invocation
 return f
 
+@propertycache
 def dirs(self):
 """Returns a set-like object containing all the directories in the
 current dirstate.
diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -519,7 +519,7 @@
 'a' in dirstate
 def d():
 dirstate.dirs()
-del dirstate._dirs
+del dirstate._map.dirs
 timer(d)
 fm.end()
 
@@ -538,8 +538,8 @@
 timer, fm = gettimer(ui, opts)
 "a" in repo.dirstate
 def d():
-"a" in repo.dirstate._dirs
-del repo.dirstate._dirs
+"a" in repo.dirstate._map.dirs
+del repo.dirstate._map.dirs
 timer(d)
 fm.end()
 
@@ -562,7 +562,7 @@
 def d():
 dirstate._dirfoldmap.get('a')
 del dirstate._dirfoldmap
-del dirstate._dirs
+del dirstate._map.dirs
 timer(d)
 fm.end()
 



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


D979: dirstate: move nonnormal and otherparent sets to dirstatemap

2017-10-13 Thread durham (Durham Goode)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG60927b19ed65: dirstate: move nonnormal and otherparent sets 
to dirstatemap (authored by durham, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D979?vs=2509=2708

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

AFFECTED FILES
  contrib/dirstatenonnormalcheck.py
  mercurial/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -138,18 +138,6 @@
 return self._identity
 
 @propertycache
-def _nonnormalset(self):
-nonnorm, otherparents = self._map.nonnormalentries()
-self._otherparentset = otherparents
-return nonnorm
-
-@propertycache
-def _otherparentset(self):
-nonnorm, otherparents = self._map.nonnormalentries()
-self._nonnormalset = nonnorm
-return otherparents
-
-@propertycache
 def _filefoldmap(self):
 return self._map.filefoldmap()
 
@@ -349,7 +337,8 @@
 self._map.setparents(p1, p2)
 copies = {}
 if oldp2 != nullid and p2 == nullid:
-candidatefiles = self._nonnormalset.union(self._otherparentset)
+candidatefiles = self._map.nonnormalset.union(
+self._map.otherparentset)
 for f in candidatefiles:
 s = self._map.get(f)
 if s is None:
@@ -401,8 +390,7 @@
 
 for a in ("_map", "_identity",
   "_filefoldmap", "_dirfoldmap", "_branch",
-  "_dirs", "_ignore", "_nonnormalset",
-  "_otherparentset"):
+  "_dirs", "_ignore"):
 if a in self.__dict__:
 delattr(self, a)
 self._lastnormaltime = 0
@@ -460,19 +448,19 @@
 self._updatedfiles.add(f)
 self._map[f] = dirstatetuple(state, mode, size, mtime)
 if state != 'n' or mtime == -1:
-self._nonnormalset.add(f)
+self._map.nonnormalset.add(f)
 if size == -2:
-self._otherparentset.add(f)
+self._map.otherparentset.add(f)
 
 def normal(self, f):
 '''Mark a file normal and clean.'''
 s = os.lstat(self._join(f))
 mtime = s.st_mtime
 self._addpath(f, 'n', s.st_mode,
   s.st_size & _rangemask, mtime & _rangemask)
 self._map.copymap.pop(f, None)
-if f in self._nonnormalset:
-self._nonnormalset.remove(f)
+if f in self._map.nonnormalset:
+self._map.nonnormalset.remove(f)
 if mtime > self._lastnormaltime:
 # Remember the most recent modification timeslot for status(),
 # to make sure we won't miss future size-preserving file content
@@ -500,8 +488,8 @@
 return
 self._addpath(f, 'n', 0, -1, -1)
 self._map.copymap.pop(f, None)
-if f in self._nonnormalset:
-self._nonnormalset.remove(f)
+if f in self._map.nonnormalset:
+self._map.nonnormalset.remove(f)
 
 def otherparent(self, f):
 '''Mark as coming from the other parent, always dirty.'''
@@ -534,9 +522,9 @@
 size = -1
 elif entry[0] == 'n' and entry[2] == -2: # other parent
 size = -2
-self._otherparentset.add(f)
+self._map.otherparentset.add(f)
 self._map[f] = dirstatetuple('r', 0, size, 0)
-self._nonnormalset.add(f)
+self._map.nonnormalset.add(f)
 if size == 0:
 self._map.copymap.pop(f, None)
 
@@ -552,8 +540,8 @@
 self._dirty = True
 self._droppath(f)
 del self._map[f]
-if f in self._nonnormalset:
-self._nonnormalset.remove(f)
+if f in self._map.nonnormalset:
+self._map.nonnormalset.remove(f)
 self._map.copymap.pop(f, None)
 
 def _discoverpath(self, path, normed, ignoremissing, exists, storemap):
@@ -632,8 +620,6 @@
 
 def clear(self):
 self._map = dirstatemap(self._ui, self._opener, self._root)
-self._nonnormalset = set()
-self._otherparentset = set()
 if "_dirs" in self.__dict__:
 delattr(self, "_dirs")
 self._map.setparents(nullid, nullid)
@@ -687,7 +673,7 @@
 e = dmap.get(f)
 if e is not None and e[0] == 'n' and e[3] == now:
 dmap[f] = dirstatetuple(e[0], e[1], e[2], -1)
-self._nonnormalset.add(f)
+self._map.nonnormalset.add(f)
 
 # emulate that all 'dirstate.normal' results are written out
 self._lastnormaltime = 0
@@ -740,7 +726,6 @@
 break
 
 self._map.write(st, now)
-self._nonnormalset, self._otherparentset = 

D978: dirstate: move write into dirstatemap

2017-10-13 Thread durham (Durham Goode)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGe2214632c3a2: dirstate: move write into dirstatemap 
(authored by durham, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D978?vs=2508=2707

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

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -739,12 +739,10 @@
 now = end # trust our estimate that the end is near now
 break
 
-st.write(parsers.pack_dirstate(self._map._map, self._map.copymap,
-   self._pl, now))
+self._map.write(st, now)
 self._nonnormalset, self._otherparentset = self._map.nonnormalentries()
-st.close()
 self._lastnormaltime = 0
-self._dirty = self._map._dirtyparents = False
+self._dirty = False
 
 def _dirignore(self, f):
 if f == '.':
@@ -1401,3 +1399,9 @@
 p = parse_dirstate(self._map, self.copymap, st)
 if not self._dirtyparents:
 self.setparents(*p)
+
+def write(self, st, now):
+st.write(parsers.pack_dirstate(self._map, self.copymap,
+   self.parents(), now))
+st.close()
+self._dirtyparents = False



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


D977: dirstate: move _read into dirstatemap

2017-10-13 Thread durham (Durham Goode)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGe159f217230e: dirstate: move _read into dirstatemap 
(authored by durham, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D977?vs=2507=2706

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

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -386,53 +386,11 @@
 raise
 
 def _read(self):
-self._map = dirstatemap(self._ui, self._opener, self._root)
-
 # ignore HG_PENDING because identity is used only for writing
 self._identity = util.filestat.frompath(
 self._opener.join(self._filename))
-try:
-fp = self._map._opendirstatefile()
-try:
-st = fp.read()
-finally:
-fp.close()
-except IOError as err:
-if err.errno != errno.ENOENT:
-raise
-return
-if not st:
-return
-
-if util.safehasattr(parsers, 'dict_new_presized'):
-# Make an estimate of the number of files in the dirstate based on
-# its size. From a linear regression on a set of real-world repos,
-# all over 10,000 files, the size of a dirstate entry is 85
-# bytes. The cost of resizing is significantly higher than the cost
-# of filling in a larger presized dict, so subtract 20% from the
-# size.
-#
-# This heuristic is imperfect in many ways, so in a future dirstate
-# format update it makes sense to just record the number of entries
-# on write.
-self._map._map = parsers.dict_new_presized(len(st) / 71)
-
-# Python's garbage collector triggers a GC each time a certain number
-# of container objects (the number being defined by
-# gc.get_threshold()) are allocated. parse_dirstate creates a tuple
-# for each file in the dirstate. The C version then immediately marks
-# them as not to be tracked by the collector. However, this has no
-# effect on when GCs are triggered, only on what objects the GC looks
-# into. This means that O(number of files) GCs are unavoidable.
-# Depending on when in the process's lifetime the dirstate is parsed,
-# this can get very expensive. As a workaround, disable GC while
-# parsing the dirstate.
-#
-# (we cannot decorate the function directly since it is in a C module)
-parse_dirstate = util.nogc(parsers.parse_dirstate)
-p = parse_dirstate(self._map._map, self._map.copymap, st)
-if not self._map._dirtyparents:
-self._map.setparents(*p)
+self._map = dirstatemap(self._ui, self._opener, self._root)
+self._map.read()
 
 def invalidate(self):
 '''Causes the next access to reread the dirstate.
@@ -1399,3 +1357,47 @@
 def setparents(self, p1, p2):
 self._parents = (p1, p2)
 self._dirtyparents = True
+
+def read(self):
+try:
+fp = self._opendirstatefile()
+try:
+st = fp.read()
+finally:
+fp.close()
+except IOError as err:
+if err.errno != errno.ENOENT:
+raise
+return
+if not st:
+return
+
+if util.safehasattr(parsers, 'dict_new_presized'):
+# Make an estimate of the number of files in the dirstate based on
+# its size. From a linear regression on a set of real-world repos,
+# all over 10,000 files, the size of a dirstate entry is 85
+# bytes. The cost of resizing is significantly higher than the cost
+# of filling in a larger presized dict, so subtract 20% from the
+# size.
+#
+# This heuristic is imperfect in many ways, so in a future dirstate
+# format update it makes sense to just record the number of entries
+# on write.
+self._map = parsers.dict_new_presized(len(st) / 71)
+
+# Python's garbage collector triggers a GC each time a certain number
+# of container objects (the number being defined by
+# gc.get_threshold()) are allocated. parse_dirstate creates a tuple
+# for each file in the dirstate. The C version then immediately marks
+# them as not to be tracked by the collector. However, this has no
+# effect on when GCs are triggered, only on what objects the GC looks
+# into. This means that O(number of files) GCs are unavoidable.
+# Depending on when in the process's lifetime the dirstate is parsed,
+# this can get very expensive. As a workaround, disable GC while
+# parsing the 

D980: dirstate: move identity to dirstatemap

2017-10-13 Thread durham (Durham Goode)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGc6ef9a2498a5: dirstate: move identity to dirstatemap 
(authored by durham, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D980?vs=2510=2709

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

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -133,11 +133,6 @@
 return self._map
 
 @propertycache
-def _identity(self):
-self._read()
-return self._identity
-
-@propertycache
 def _filefoldmap(self):
 return self._map.filefoldmap()
 
@@ -375,9 +370,6 @@
 raise
 
 def _read(self):
-# ignore HG_PENDING because identity is used only for writing
-self._identity = util.filestat.frompath(
-self._opener.join(self._filename))
 self._map = dirstatemap(self._ui, self._opener, self._root)
 self._map.read()
 
@@ -388,8 +380,7 @@
 rereads the dirstate. Use localrepo.invalidatedirstate() if you want to
 check whether the dirstate has changed before rereading it.'''
 
-for a in ("_map", "_identity",
-  "_filefoldmap", "_dirfoldmap", "_branch",
+for a in ("_map", "_filefoldmap", "_dirfoldmap", "_branch",
   "_dirs", "_ignore"):
 if a in self.__dict__:
 delattr(self, a)
@@ -652,7 +643,7 @@
 If identity of previous dirstate is equal to this, writing
 changes based on the former dirstate out can keep consistency.
 '''
-return self._identity
+return self._map.identity
 
 def write(self, tr):
 if not self._dirty:
@@ -1342,6 +1333,10 @@
 self._dirtyparents = True
 
 def read(self):
+# ignore HG_PENDING because identity is used only for writing
+self.identity = util.filestat.frompath(
+self._opener.join(self._filename))
+
 try:
 fp = self._opendirstatefile()
 try:
@@ -1404,3 +1399,8 @@
 self.nonnormalset = nonnorm
 return otherparents
 
+@propertycache
+def identity(self):
+self.read()
+return self.identity
+



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


D1057: use arbitraryfilectx for backups

2017-10-13 Thread durin42 (Augie Fackler)
durin42 requested changes to this revision.
durin42 added a comment.
This revision now requires changes to proceed.


  (Feel free to push back with a TODO documenting how to do a fix or something.)

INLINE COMMENTS

> filemerge.py:604
>  return None
> -
> +from . import context
>  a = _workingpath(repo, fcd)

Well that's a bummer. Could we move context.*filectx* into 
mercurial.filecontext and then avoid the need for this function-level import?

REPOSITORY
  rHG Mercurial

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

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


D985: tersestatus: re-implement the functionality to terse the status

2017-10-13 Thread durin42 (Augie Fackler)
durin42 added inline comments.

INLINE COMMENTS

> cmdutil.py:406-408
> +# extracted at module level as it's required each time a file will be added
> +# to dirnode class object below
> +pathsep = pycompat.ossep

Perversely, locals are significantly faster than globals in Python. Not going 
to block landing this patch on the change, but it *might* show up in a perf* 
command to cache this locally in the function it's used in.

REPOSITORY
  rHG Mercurial

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

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


D1063: rebase: enable multidest by default

2017-10-13 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  In https://phab.mercurial-scm.org/D1063#17789, @durin42 wrote:
  
  > I'm a fan. Will give it to Monday for any objections.
  
  
  I'm against. I'd like to see that the feature is indeed powerful enough for 
handling the intended use cases before we turn it on. Once it's on, we can't go 
back. The intended use case I'm aware of is to mimic "hg restack", IIUC. Maybe 
you have already switched over to using this (multi-dest rebase) internally at 
FB and seen that it does work well?
  
  What's the advantage of turning it on? It seems like very few users would use 
it directly anyway. Won't you provide aliases instead and those aliases could 
then also enable the feature?

REPOSITORY
  rHG Mercurial

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

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


Re: [POLL] Mass renaming options for consistency + guidelines

2017-10-13 Thread Augie Fackler

> On Oct 14, 2017, at 12:38 AM, Martin von Zweigbergk  
> wrote:
> 
> 
> 
> On Fri, Oct 13, 2017 at 9:33 PM, Augie Fackler  wrote:
> 
> > On Jul 19, 2017, at 10:14 AM, Augie Fackler  wrote:
> >
> >
> >> On Jul 19, 2017, at 09:11, Yuya Nishihara  wrote:
> >>
>  I prefer not doing mass renaming that would generate lots of "deprecated"
>  config names in use around user hgrc and web documents. But if I had to
>  choose one, I would vote for dashes/hyphens.
> >>>
> >>> We could also do what gmail does with email addresses and periods:
> >>> they allow extra periods anywhere (I think). So allowpull and
> >>> allow-pull and all-owpull would be all be the same config option. Just
> >>> a thought; I'm not sure what I think.
> >>
> >> I'm not a fan of ambiguating identifiers. It smells like case-insensitive 
> >> fs,
> >> computer language, etc. that do sometimes surprising.
> >
> > Agreed. I had previously proposed exactly this, but in the intervening 
> > years I've come to agree with Yuya that it's likely to be more confusing 
> > than anything in the long run.
> 
> So, in reviewing https://phab.mercurial-scm.org/D932, it was noted that 
> https://www.mercurial-scm.org/wiki/UIGuideline?action=diff=10=11 
> concluded that there was a decision, but I don’t see any kind of consensus on 
> this thread. Are we comfortable with this as the guidance going forward?
> 
> I am, but I wanted to make sure there’s some well-documented consensus of the 
> policy change.
> 
> Me too. Hyphen-separated words sounds good (just repeating that here to 
> clarify that that is the decision we're talking about).

Yep, that’s the one. Right now, my understanding of positions on 
hyphen-separated-words is as follows:

durin42: +1
martinvonz: +1
David Demelier: +1
Yuya: ? (I think +0 on hyphens at least for new config knobs?)

Please add yourself via reply if you have an opinion, or correct me if I’m 
wrong. Thanks!


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


Re: [POLL] Mass renaming options for consistency + guidelines

2017-10-13 Thread Martin von Zweigbergk via Mercurial-devel
On Fri, Oct 13, 2017 at 9:33 PM, Augie Fackler  wrote:

>
> > On Jul 19, 2017, at 10:14 AM, Augie Fackler  wrote:
> >
> >
> >> On Jul 19, 2017, at 09:11, Yuya Nishihara  wrote:
> >>
>  I prefer not doing mass renaming that would generate lots of
> "deprecated"
>  config names in use around user hgrc and web documents. But if I had
> to
>  choose one, I would vote for dashes/hyphens.
> >>>
> >>> We could also do what gmail does with email addresses and periods:
> >>> they allow extra periods anywhere (I think). So allowpull and
> >>> allow-pull and all-owpull would be all be the same config option. Just
> >>> a thought; I'm not sure what I think.
> >>
> >> I'm not a fan of ambiguating identifiers. It smells like
> case-insensitive fs,
> >> computer language, etc. that do sometimes surprising.
> >
> > Agreed. I had previously proposed exactly this, but in the intervening
> years I've come to agree with Yuya that it's likely to be more confusing
> than anything in the long run.
>
> So, in reviewing https://phab.mercurial-scm.org/D932, it was noted that
> https://www.mercurial-scm.org/wiki/UIGuideline?action=diff=10=11
> concluded that there was a decision, but I don’t see any kind of consensus
> on this thread. Are we comfortable with this as the guidance going forward?
>
> I am, but I wanted to make sure there’s some well-documented consensus of
> the policy change.
>

Me too. Hyphen-separated words sounds good (just repeating that here to
clarify that that is the decision we're talking about).


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


D1063: rebase: enable multidest by default

2017-10-13 Thread durin42 (Augie Fackler)
durin42 accepted this revision as: durin42.
durin42 added a comment.


  I'm a fan. Will give it to Monday for any objections.

REPOSITORY
  rHG Mercurial

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

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


D932: filemerge: introduce functions to halt merge flow

2017-10-13 Thread durin42 (Augie Fackler)
durin42 added a comment.


  I've landed this stack through https://phab.mercurial-scm.org/D931, will hold 
this one until at least Monday in case anyone objects on the style change.

INLINE COMMENTS

> ryanmce wrote in configitems.py:302
> this could be `on-failure`, per the comment on 
> https://phab.mercurial-scm.org/D789

I'm following up on the list (with @ryanmce cc'ed) about the policy change - I 
dug up the email thread and it kind of trailed off without any kind of clear 
consensus that we should change.

FWIW, I like this style, and endorse it, I just want to make sure nobody 
objects before we lock it in. :)

REPOSITORY
  rHG Mercurial

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

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


Re: [POLL] Mass renaming options for consistency + guidelines

2017-10-13 Thread Augie Fackler

> On Jul 19, 2017, at 10:14 AM, Augie Fackler  wrote:
> 
> 
>> On Jul 19, 2017, at 09:11, Yuya Nishihara  wrote:
>> 
 I prefer not doing mass renaming that would generate lots of "deprecated"
 config names in use around user hgrc and web documents. But if I had to
 choose one, I would vote for dashes/hyphens.
>>> 
>>> We could also do what gmail does with email addresses and periods:
>>> they allow extra periods anywhere (I think). So allowpull and
>>> allow-pull and all-owpull would be all be the same config option. Just
>>> a thought; I'm not sure what I think.
>> 
>> I'm not a fan of ambiguating identifiers. It smells like case-insensitive fs,
>> computer language, etc. that do sometimes surprising.
> 
> Agreed. I had previously proposed exactly this, but in the intervening years 
> I've come to agree with Yuya that it's likely to be more confusing than 
> anything in the long run.

So, in reviewing https://phab.mercurial-scm.org/D932, it was noted that 
https://www.mercurial-scm.org/wiki/UIGuideline?action=diff=10=11 
concluded that there was a decision, but I don’t see any kind of consensus on 
this thread. Are we comfortable with this as the guidance going forward?

I am, but I wanted to make sure there’s some well-documented consensus of the 
policy change.

Thanks!
Augie


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


D1062: tweakdefaults: make experimental.updatecheck be `noconflict`

2017-10-13 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  > Open question: should we move this config knob to someplace other than
  > [experimental] before we put it in tweakdefaults? I think we
  > should. In that case, where does it move? commands.update.check?
  
  Yes. I also think we should move this config and commands.update.check sounds 
good.

REPOSITORY
  rHG Mercurial

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

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


D1047: tweakdefaults: add restack command

2017-10-13 Thread durin42 (Augie Fackler)
durin42 added a comment.


  In https://phab.mercurial-scm.org/D1047#17724, @quark wrote:
  
  > In https://phab.mercurial-scm.org/D1047#17715, @durin42 wrote:
  >
  > > The only concern I have is that this is pretty complicated to express in 
a revset, but if we can figure it out that's almost certainly the way to go...
  >
  >
  > If this is the only concern, how about defining a `_deststabilize(src, 
allsrc)` revset in `rebase`? (since we already have `_destrebase` for now) Then 
the user-facing revset could be shorter and do not require PhD-level knowledge 
to write. This solves extra problems, like we can do extra work to handle the 
divergence case, and do some caching to improve performance on huge repos in 
the revset implementation.
  
  
  Seems fine to me, maybe write up a brief proposal so people don't have to 
read the whole comment thread here?

REPOSITORY
  rHG Mercurial

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

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


D1047: tweakdefaults: add restack command

2017-10-13 Thread durin42 (Augie Fackler)
durin42 added a comment.


  In https://phab.mercurial-scm.org/D1047#17725, @quark wrote:
  
  > The reason I perfer a revset alias is it's more flexible: people can define 
`auto2` so `-d auto2` just works. Or use `auto` in a more complex way: 
`first(auto|myauto)` (if auto cannot find the destination, use `myauto`).
  
  
  Yeah, that makes sense to me.

REPOSITORY
  rHG Mercurial

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

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


D1044: bisect: add --abort flag

2017-10-13 Thread durin42 (Augie Fackler)
durin42 added a comment.


  I'm -0 on the behavior. I'd be indifferent about adding a --abort to bisect 
that just is an alias for --reset.
  
  (I still think it's extremely weird that ~everyone at Facebook sees bisect as 
a modal command like histedit or rebase.)

REPOSITORY
  rHG Mercurial

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

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


D1044: bisect: add --abort flag

2017-10-13 Thread quark (Jun Wu)
quark added inline comments.

INLINE COMMENTS

> ryanmce wrote in commands.py:809
> I agree. This can be a status or even an info. +1 on the idea of mentioning 
> the parent.

rebase uses `ui.warn`. histedit does not have this output. `ui.write` will 
cause inconsistency. Maybe it's "safer" to just not output anything.

REPOSITORY
  rHG Mercurial

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

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


D1044: bisect: add --abort flag

2017-10-13 Thread quark (Jun Wu)
quark updated this revision to Diff 2705.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1044?vs=2655=2705

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

AFFECTED FILES
  mercurial/commands.py
  mercurial/hbisect.py
  tests/test-bisect-abort.t

CHANGE DETAILS

diff --git a/tests/test-bisect-abort.t b/tests/test-bisect-abort.t
new file mode 100644
--- /dev/null
+++ b/tests/test-bisect-abort.t
@@ -0,0 +1,36 @@
+  $ cat >> $HGRCPATH < [extensions]
+  > drawdag=$TESTDIR/drawdag.py
+  > EOF
+
+  $ hg init
+  $ hg debugdrawdag <<'EOS'
+  > D
+  > |
+  > C
+  > |
+  > B
+  > |
+  > A
+  > EOS
+
+  $ hg update -q C
+  $ hg bisect --abort
+  abort: not bisect in progress
+  [255]
+
+  $ hg bisect --good D
+  $ hg bisect --bad A
+  Testing changeset 1:112478962961 (3 changesets remaining, ~1 tests)
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
+  $ echo 1 >> A
+  $ hg bisect --abort
+  abort: uncommitted changes
+  [255]
+
+  $ hg update -q -C .
+  $ hg bisect --abort
+
+  $ hg log -r . -T '{desc}\n'
+  C
diff --git a/mercurial/hbisect.py b/mercurial/hbisect.py
--- a/mercurial/hbisect.py
+++ b/mercurial/hbisect.py
@@ -154,24 +154,27 @@
 return None
 
 def load_state(repo):
-state = {'current': [], 'good': [], 'bad': [], 'skip': []}
+state = {'current': [], 'good': [], 'bad': [], 'skip': [], 'original': []}
 for l in repo.vfs.tryreadlines("bisect.state"):
 kind, node = l[:-1].split()
 node = repo.lookup(node)
 if kind not in state:
 raise error.Abort(_("unknown bisect kind %s") % kind)
 state[kind].append(node)
 return state
 
-
 def save_state(repo, state):
 f = repo.vfs("bisect.state", "w", atomictemp=True)
 with repo.wlock():
 for kind in sorted(state):
 for node in state[kind]:
 f.write("%s %s\n" % (kind, hex(node)))
 f.close()
 
+def stateexists(repo):
+"""return True if bisect state exists, False otherwise"""
+return repo.vfs.exists("bisect.state")
+
 def resetstate(repo):
 """remove any bisect state from the repository"""
 if repo.vfs.exists("bisect.state"):
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -670,11 +670,14 @@
 ('s', 'skip', False, _('skip testing changeset')),
 ('e', 'extend', False, _('extend the bisect range')),
 ('c', 'command', '', _('use command to check changeset state'), _('CMD')),
-('U', 'noupdate', False, _('do not update to target'))],
+('U', 'noupdate', False, _('do not update to target')),
+('', 'abort', False,
+ _('abort bisect and update to the original changeset')),
+],
 _("[-gbsr] [-U] [-c CMD] [REV]"))
 def bisect(ui, repo, rev=None, extra=None, command=None,
reset=None, good=None, bad=None, skip=None, extend=None,
-   noupdate=None):
+   noupdate=None, abort=None):
 """subdivision search of changesets
 
 This command helps to find changesets which introduce problems. To
@@ -770,6 +773,7 @@
 raise error.Abort(_('incompatible arguments'))
 
 incompatibles = {
+'--abort': abort,
 '--bad': bad,
 '--command': bool(command),
 '--extend': extend,
@@ -788,8 +792,26 @@
 hbisect.resetstate(repo)
 return
 
+firsttime = not hbisect.stateexists(repo)
 state = hbisect.load_state(repo)
 
+if abort:
+if firsttime:
+raise error.Abort(_('not bisect in progress'))
+cmdutil.checkunfinished(repo)
+cmdutil.bailifchanged(repo)
+if not state['original']:
+ui.warn(_('warning: not updating since bisect state did not '
+  'include original changeset\n'))
+else:
+node = state['original'][0]
+hg.clean(repo, node, show_stats=False)
+hbisect.resetstate(repo)
+return
+
+if firsttime:
+state['original'] = [repo['.'].node()]
+
 # update state
 if good or bad or skip:
 if rev:



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


D1062: tweakdefaults: make experimental.updatecheck be `noconflict`

2017-10-13 Thread quark (Jun Wu)
quark accepted this revision.
quark added a comment.


  It seems a good candidate of `[commands]`.

REPOSITORY
  rHG Mercurial

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

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


D1047: tweakdefaults: add restack command

2017-10-13 Thread quark (Jun Wu)
quark added a comment.


  The reason I perfer a revset alias is it's more flexible: people can define 
`auto2` so `-d auto2` just works. Or use `auto` in a more complex way: 
`first(auto|myauto)` (if auto cannot find the destination, use `myauto`).

REPOSITORY
  rHG Mercurial

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

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


D1047: tweakdefaults: add restack command

2017-10-13 Thread quark (Jun Wu)
quark added a comment.


  In https://phab.mercurial-scm.org/D1047#17715, @durin42 wrote:
  
  > The only concern I have is that this is pretty complicated to express in a 
revset, but if we can figure it out that's almost certainly the way to go...
  
  
  If this is the only concern, how about defining a `_deststabilize(src, 
allsrc)` revset in `rebase`? (since we already have `_destrebase` for now) Then 
the user-facing revset could be shorter. This solves extra problems, like we 
can do extra work to handle the divergence case, and do some caching to improve 
performance on huge repos in the revset implementation.

REPOSITORY
  rHG Mercurial

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

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


D1063: rebase: enable multidest by default

2017-10-13 Thread quark (Jun Wu)
quark created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This was intended to be done by https://phab.mercurial-scm.org/D470. But 
there was a minor documentation
  issue. The feature is quite usable now so it gets formally documented and
  enabled.
  
  There is no behavior change for people not using the `SRC` or `ALLSRC` in
  rebase destination revset.
  
  .. feature:: Rebase with different destination per source revision
  
Previously, rebase only supports one unique destination. Now ``SRC`` and
``ALLSRC`` can be used in rebase destination revset to precisely define
destination per each individual source revision.

For example, the following command could move some orphaned changesets to
reasonable new places so they become no longer orphaned::

  hg rebase
-r 'orphan()-obsolete()'
-d 'max((successors(max(roots(ALLSRC) & ::SRC)^)-obsolete())::)'

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/rebase.py
  mercurial/configitems.py
  tests/test-rebase-dest.t

CHANGE DETAILS

diff --git a/tests/test-rebase-dest.t b/tests/test-rebase-dest.t
--- a/tests/test-rebase-dest.t
+++ b/tests/test-rebase-dest.t
@@ -115,7 +115,6 @@
   > [extensions]
   > maprevset=$TESTTMP/maprevset.py
   > [experimental]
-  > rebase.multidest=true
   > stabilization=all
   > EOF
 
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -341,9 +341,6 @@
 coreconfigitem('experimental', 'obsmarkers-exchange-debug',
 default=False,
 )
-coreconfigitem('experimental', 'rebase.multidest',
-default=False,
-)
 coreconfigitem('experimental', 'revertalternateinteractivemode',
 default=True,
 )
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -638,6 +638,11 @@
   4. If you do not specify any of ``--rev``, ``source``, or ``--base``,
  rebase will use ``--base .`` as above.
 
+If ``--source`` or ``--rev`` is used, special names ``SRC`` and ``ALLSRC``
+can be used in ``--dest``. Destination would be calculated per source
+revision with ``SRC`` substituted by that single source revision and
+``ALLSRC`` substituted by all source revisions.
+
 Rebase will destroy original changesets unless you use ``--keep``.
 It will also move your bookmarks (even if you do).
 
@@ -686,6 +691,12 @@
 
   hg rebase -r "branch(featureX)" -d 1.3 --keepbranches
 
+  - stabilize orphaned changesets so history looks linear::
+
+  hg rebase -r 'orphan()-obsolete()'\
+ -d 'first(max((successors(max(roots(ALLSRC) & ::SRC)^)-obsolete())::) +\
+ max(::((roots(ALLSRC) & ::SRC)^)-obsolete()))'
+
 Configuration Options:
 
 You can make rebase require a destination if you set the following config
@@ -878,8 +889,6 @@
 # fast path: try to resolve dest without SRC alias
 dest = scmutil.revsingle(repo, destf, localalias=alias)
 except error.RepoLookupError:
-if not ui.configbool('experimental', 'rebase.multidest'):
-raise
 # multi-dest path: resolve dest for each SRC separately
 destmap = {}
 for r in rebaseset:



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


D1047: tweakdefaults: add restack command

2017-10-13 Thread durin42 (Augie Fackler)
durin42 added a comment.


  In https://phab.mercurial-scm.org/D1047#17714, @quark wrote:
  
  > In https://phab.mercurial-scm.org/D1047#17692, @durin42 wrote:
  >
  > > Counterproposal:
  > >
  > > `hg rebase --auto `
  > >
  > > or
  > >
  > > `hg rebase --auto -r `
  > >
  > > rather than introducing a new concept of a stack. I know Facebook has 
this concept internally, but for core hg we don't have the notion of a stack 
outside `mq` and `show`: the former is heavily deprecated, and the latter is 
experimental and still subject to change. Also, I feel like 'automatic rebase' 
is a pretty good description of what's actually happening to resolve the 
trivial orphans-only trouble cases. Thoughts?
  > >
  > > I'd be happy to spend a bit of time writing up a commit for rebase--auto 
if people want to play with it.
  >
  >
  > I'm unconvinced that `--auto` should be bound to the concept of 
stabilization. I think it should be made more flexible. ex. some users may ask 
"why --auto does not rebase my commits to master"?
  
  
  That's a good point. In a perfect world you'd do something like "rebase to my 
successor, unless my successor is an ancestor of the 
otherwise-default-destination, in which case rebase to there."
  
  > Currently, rebase has a non-configurable `_destrebase` revset that is used 
when `-d` is not specified. It's basically useless. And we even have 
`commands.rebase.requiredest` to disable it.
  > 
  > I think we can have proper ways to make it possible that the "default" 
behavior is useful and does the "--auto" thing, while still being flexible.
  > 
  > What I'm thinking about is a config section like:
  > 
  >   [revsetalias:rebase.dest] # revsetalias that is only used in rebase 
destination scope
  >   auto = if(SRC is orphan and 
obsoleted,first(max((successors(max(roots(ALLSRC) & 
::SRC)^)-obsolete())::)+max(::((roots(ALLSRC) & ::SRC)^)-obsolete()
  >   # missing bit: express "ifempty(x, trueset, falseset)" in revset language
  
  I like where your head is at, but I think I'd probably do `[command] 
rebase.dest.auto` to be in line with our current direction on commands.
  
  The only concern I have is that this is pretty complicated to express in a 
revset, but if we can figure it out that's almost certainly the way to go...
  
  > Benefit:
  > 
  > 1. Users can run `hg rebase -r 'draft()' -d auto`, which seems to be 
convenient enough.
  > 2. Sysadmins can override the config so it also works for rebasing to 
`master`. More flexible.
  > 
  >   In addition, we can have something like:
  > 
  >   [commands] # ignored by HGPLAIN rebase.defaultsrcdest = "not public()", 
auto # used when both src and dest are not provided rebase.defaultdest = auto # 
used when src is provided, but not dest rebase.defaultsrc = ("not public()" & 
::.)+(.::)  # used when src is not provided, but dest is provided
  > 
  >   Then users can just run `hg rebase` without arguments.
  
  Overall, I like the (configurable) `rebase --dest auto`, and I think that 
configurable destination shorthand(s) is meritorious even if it doesn't obviate 
an eventual `hg restack` or `hg stabilize` (though I think it does, at least 
for the basic case of having some non-divergent orphans, at least well enough 
we could start enabling more of the obsolete/rebase/histedit/amend stuff out of 
the box.)

REPOSITORY
  rHG Mercurial

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

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


[PATCH] build: for the bootstrap phase of a deb/rpm build a pure python mercurial is enough

2017-10-13 Thread muxator via Mercurial-devel
# HG changeset patch
# User muxator 
# Date 1507927337 -7200
#  Fri Oct 13 22:42:17 2017 +0200
# Node ID e9cb85a4d570b3e36df8df953d1c4b99fc00d922
# Parent  7259f0ddfc0f18138420e7c9c7e4145a25016d7b
build: for the bootstrap phase of a deb/rpm build a pure python mercurial is 
enough

When bootstrapping a deb/rpm build, packagelib.sh starts performing a local
build for the sole purpose of parsing the output of "hg version".
Then it "hg archive"s the source code, and builds everything again.

For that initial step, we are perfectly good in using a pure python mercurial,
without compiling the c modules (base85, bdiff, zstdlib, ...).

On my personal system, this cuts down 22 seconds for a package build (the
bootstrapping build goes from ~30 to ~8 seconds).

diff --git a/contrib/packagelib.sh b/contrib/packagelib.sh
--- a/contrib/packagelib.sh
+++ b/contrib/packagelib.sh
@@ -9,7 +9,7 @@
 # node: the node|short hg was built from, or empty if built from a tag
 gethgversion() {
 make cleanbutpackages
-make local || make local PURE=--pure
+make local PURE=--pure
 HG="$PWD/hg"
 
 $HG version > /dev/null || { echo 'abort: hg version failed!'; exit 1 ; }
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] build: no need to build zstd in the bootstrap phase of a deb/rpm build

2017-10-13 Thread Augie Fackler

> On Oct 13, 2017, at 16:53, muxator  wrote:
> 
> Way more elegant, thanks!
> 
> On a closer look, an even simpler fix is possible: a "make local PURE=--pure" 
> in packagelib.sh would be sufficient: no need to compile any c modules at all 
> (base85, bdiff, zstd).
> 
> I am going to send a simpler patch.
> 
> 
> btw: is it better to send patches via email or Phabricator?

Neither is really preferential - I'm still happier to work on emailed patches, 
but if you're more comfortable with phabricator that's fine too. I do 
prioritize emailed patches though. :)

> 
> 
> 
> On 10/13/2017 06:22 PM, Augie Fackler wrote:
>> On Thu, Oct 12, 2017 at 09:09:26PM +0200, muxator via Mercurial-devel wrote:
>>> # HG changeset patch
>>> # User muxator 
>>> # Date 1507834828 -7200
>>> #  Thu Oct 12 21:00:28 2017 +0200
>>> # Node ID f91472aa5015bd16b8585e53ba34d64a7a05c8c7
>>> # Parent  7259f0ddfc0f18138420e7c9c7e4145a25016d7b
>>> build: no need to build zstd in the bootstrap phase of a deb/rpm build
>>> 
>>> When bootstrapping a deb/rpm build, packagelib.sh starts performing a local
>>> build for the sole purpose of parsing the output of "hg version".
>>> Then it "hg archive"s the source code, and builds everything again.
>>> 
>>> For that initial initial step, there is no purpose in compiling zstdlib.
>>> This commit adds another target "make local-no-zstd", which is called by
>>> packagelib.sh for the initial bootstrapping.
>>> 
>>> On my personal system, this cuts down 20 seconds for a package build (the
>>> bootstrapping build goes from ~30 to ~10 seconds).
>>> 
>>> diff --git a/Makefile b/Makefile
>>> --- a/Makefile
>>> +++ b/Makefile
>>> @@ -44,14 +44,20 @@
>>> 
>>>  all: build doc
>>> 
>>> -local:
>>> +local-inner:
>>>   $(PYTHON) setup.py $(PURE) \
>>> build_py -c -d . \
>>> -   build_ext $(COMPILERFLAG) -i \
>>> +   build_ext $(COMPILERFLAG) $(ZSTD) -i \
>>> build_hgexe $(COMPILERFLAG) -i \
>>> build_mo
>>>   env HGRCPATH= $(PYTHON) hg version
>>> 
>>> +local: ZSTD=--zstd
>>> +local: local-inner
>>> +
>>> +local-no-zstd: ZSTD=--no-zstd
>>> +local-no-zstd: local-inner
>> Could we skip the addition of the local-no-zstd thing, and make the
>> ZSTD var default to --zstd, and then in the packagelib script we can
>> jsut do `make local ZSTD=--no-zstd` instead?
>> 
>>> +
>>>  build:
>>>   $(PYTHON) setup.py $(PURE) build $(COMPILERFLAG)
>>> 
>>> @@ -303,7 +309,8 @@
>>>  linux-wheels-i686:
>>>   docker run -e "HGTEST_JOBS=$(shell nproc)" --rm -ti -v `pwd`:/src 
>>> quay.io/pypa/manylinux1_i686 linux32 /src/contrib/build-linux-wheels.sh
>>> 
>>> -.PHONY: help all local build doc cleanbutpackages clean install 
>>> install-bin \
>>> +.PHONY: help all local local-inner local-no-zstd build doc \
>>> +   cleanbutpackages clean install install-bin \
>>>   install-doc install-home install-home-bin install-home-doc \
>>>   dist dist-notests check tests check-code update-pot \
>>>   osx deb ppa docker-debian-jessie docker-debian-stretch \
>>> diff --git a/contrib/packagelib.sh b/contrib/packagelib.sh
>>> --- a/contrib/packagelib.sh
>>> +++ b/contrib/packagelib.sh
>>> @@ -9,7 +9,7 @@
>>>  # node: the node|short hg was built from, or empty if built from a tag
>>>  gethgversion() {
>>>  make cleanbutpackages
>>> -make local || make local PURE=--pure
>>> +make local-no-zstd || make local-no-zstd PURE=--pure
>>>  HG="$PWD/hg"
>>> 
>>>  $HG version > /dev/null || { echo 'abort: hg version failed!'; exit 1 
>>> ; }
>>> ___
>>> 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


D1047: tweakdefaults: add restack command

2017-10-13 Thread quark (Jun Wu)
quark added a comment.


  In https://phab.mercurial-scm.org/D1047#17692, @durin42 wrote:
  
  > Counterproposal:
  >
  > `hg rebase --auto `
  >
  > or
  >
  > `hg rebase --auto -r `
  >
  > rather than introducing a new concept of a stack. I know Facebook has this 
concept internally, but for core hg we don't have the notion of a stack outside 
`mq` and `show`: the former is heavily deprecated, and the latter is 
experimental and still subject to change. Also, I feel like 'automatic rebase' 
is a pretty good description of what's actually happening to resolve the 
trivial orphans-only trouble cases. Thoughts?
  >
  > I'd be happy to spend a bit of time writing up a commit for rebase--auto if 
people want to play with it.
  
  
  I'm unconvinced that `--auto` should be bound to the concept of 
stabilization. I think it should be made more flexible. ex. some users may ask 
"why --auto does not rebase my commits to master"?
  
  Currently, rebase has a non-configurable `_destrebase` revset that is used 
when `-d` is not specified. It's basically useless. And we even have 
`commands.rebase.requiredest` to disable it.
  
  I think we can have proper ways to make it possible that the "default" 
behavior is useful and does the "--auto" thing, while still being flexible.
  
  What I'm thinking about is a config section like:
  
[revsetalias:rebase.dest] # revsetalias that is only used in rebase 
destination scope
auto = if(SRC is orphan and 
obsoleted,first(max((successors(max(roots(ALLSRC) & 
::SRC)^)-obsolete())::)+max(::((roots(ALLSRC) & ::SRC)^)-obsolete()
# missing bit: express "ifempty(x, trueset, falseset)" in revset language
  
  Benefit:
  
  1. Users can run `hg rebase -r 'draft()' -d auto`, which seems to be 
convenient enough.
  2. Sysadmins can override the config so it also works for rebasing to 
`master`. More flexible.
  
  In addition, we can have something like:
  
[commands] # ignored by HGPLAIN
rebase.defaultsrcdest = "not public()", auto # used when both src and dest 
are not provided
rebase.defaultdest = auto # used when src is provided, but not dest
rebase.defaultsrc = ("not public()" & ::.)+(.::)  # used when src is not 
provided, but dest is provided
  
  Then users can just run `hg rebase` without arguments.

REPOSITORY
  rHG Mercurial

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

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


Re: Warning: Freeze to start Tuesday

2017-10-13 Thread Augie Fackler
Kevin pointed out I'm a goofball and it should actually be on Wednesday, so 
I'll do the freeze on Wednesday.

Have a good weekend everyone!

AF

> On Oct 13, 2017, at 14:30, Augie Fackler  wrote:
> 
> Ordinarily it'd be Monday, but I'll give y'all Monday to try and get 
> last-minute features into 4.4. After that, please focus on bug fixes until 
> 4.4 final is released. Thanks!

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


D1062: tweakdefaults: make experimental.updatecheck be `noconflict`

2017-10-13 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This is the second-safest option we have to offer in `updatecheck`,
  with `abort` being the safest and `linear` being the default. At the
  sprint we discussed how much `none` and `linear` make us all
  uncomfortable, and how we'd like to move the default behavior if we can.
  
  I'm not sure we can get away with actually changing the out of the box
  default behavior, but we can at *least* do this.
  
  Open question: should we move this config knob to someplace other than
  [experimental] before we put it in tweakdefaults? I think we
  should. In that case, where does it move? commands.update.check?

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/ui.py

CHANGE DETAILS

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -54,6 +54,9 @@
 # Make `hg status` emit cwd-relative paths by default.
 status.relative = yes
 
+[experimental]
+updatecheck=noconflict
+
 [diff]
 git = 1
 """



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


D1061: context: add is `isinmemory()` to filectx

2017-10-13 Thread phillco (Phil Cohen)
phillco created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This will make it easier to skip certain behavior when running an in-memory
  merge.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -623,6 +623,9 @@
 def hidden(self):
 return self._rev in repoview.filterrevs(self._repo, 'visible')
 
+def isinmemory(self):
+return False
+
 def children(self):
 """return contexts for each child changeset"""
 c = self._repo.changelog.children(self._node)
@@ -1402,6 +1405,9 @@
 def extra(self):
 return self._extra
 
+def isinmemory(self):
+return False
+
 def tags(self):
 return []
 
@@ -1979,6 +1985,9 @@
 else:
 return self._wrappedctx[path].data()
 
+def isinmemory(self):
+return True
+
 def filedate(self, path):
 if self.isdirty(path):
 return self._cache[path]['date']



To: phillco, #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 11 of 11] configitems: register the 'templates' section

2017-10-13 Thread Augie Fackler
On Fri, Oct 13, 2017 at 07:55:17PM +0200, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld 
> # Date 1507490964 -7200
> #  Sun Oct 08 21:29:24 2017 +0200
> # Node ID c577c2524d863b5649d31ad84a15773deb9b2372
> # Parent  8f3e9e9a61021e35a5798eef6368672506890bcf
> # EXP-Topic config.register.ready
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
> c577c2524d86
> configitems: register the 'templates' section

queued, thanks, with the exception of the one patch I commented on (8
I believe)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D674: filemerge: use arbitraryfilectx for backup files

2017-10-13 Thread phillco (Phil Cohen)
phillco abandoned this revision.
phillco added a comment.


  I've split this into https://phab.mercurial-scm.org/D1056, 
https://phab.mercurial-scm.org/D1057, https://phab.mercurial-scm.org/D1058, 
https://phab.mercurial-scm.org/D1059, https://phab.mercurial-scm.org/D1060, so 
abandoning this version.
  
  @martinvonz

REPOSITORY
  rHG Mercurial

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

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


D1047: tweakdefaults: add restack command

2017-10-13 Thread durin42 (Augie Fackler)
durin42 added a comment.


  Counterproposal:
  
  `hg rebase --auto `
  
  or
  
  `hg rebase --auto -r `
  
  rather than introducing a new concept of a stack. I know Facebook has this 
concept internally, but for core hg we don't have the notion of a stack outside 
`mq` and `show`: the former is heavily deprecated, and the latter is 
experimental and still subject to change. Also, I feel like 'automatic rebase' 
is a pretty good description of what's actually happening to resolve the 
trivial orphans-only trouble cases. Thoughts?
  
  I'd be happy to spend a bit of time writing up a commit for rebase--auto if 
people want to play with it.

REPOSITORY
  rHG Mercurial

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

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


D1057: use arbitraryfilectx for backups

2017-10-13 Thread phillco (Phil Cohen)
phillco 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/D1057

AFFECTED FILES
  mercurial/filemerge.py

CHANGE DETAILS

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -7,7 +7,6 @@
 
 from __future__ import absolute_import
 
-import filecmp
 import os
 import re
 import tempfile
@@ -226,9 +225,9 @@
 return '\n'
 return None # unknown
 
-def _matcheol(file, origfile):
+def _matcheol(file, back):
 "Convert EOL markers in a file to match origfile"
-tostyle = _eoltype(util.readfile(origfile))
+tostyle = _eoltype(back.data()) # No repo.wread filters?
 if tostyle:
 data = util.readfile(file)
 style = _eoltype(data)
@@ -505,7 +504,9 @@
 
 args = _toolstr(ui, tool, "args", '$local $base $other')
 if "$output" in args:
-out, a = a, back # read input from backup, write to original
+# read input from backup, write to original
+out = a
+a = repo.wvfs.join(back.path())
 replace = {'local': a, 'base': b, 'other': c, 'output': out}
 args = util.interpolate(r'\$', replace, args,
 lambda s: util.shellquote(util.localpath(s)))
@@ -588,24 +589,24 @@
 def _restorebackup(fcd, back):
 # TODO: Add a workingfilectx.write(otherfilectx) path so we can use
 # util.copy here instead.
-fcd.write(util.readfile(back), fcd.flags())
+fcd.write(back.data(), fcd.flags())
 
-def _makebackup(repo, ui, fcd, premerge):
-"""Makes a backup of the local `fcd` file prior to merging.
+def _makebackup(repo, ui, wctx, fcd, premerge):
+"""Makes and returns a filectx-like object for ``fcd``'s backup file.
 
 In addition to preserving the user's pre-existing modifications to `fcd`
 (if any), the backup is used to undo certain premerges, confirm whether a
 merge changed anything, and determine what line endings the new file should
 have.
 """
 if fcd.isabsent():
 return None
-
+from . import context
 a = _workingpath(repo, fcd)
 back = scmutil.origpath(ui, repo, a)
 if premerge:
 util.copyfile(a, back)
-return back
+return context.arbitraryfilectx(back, repo=repo)
 
 def _maketempfiles(repo, fco, fca):
 """Writes out `fco` and `fca` as temporary files, so an external merge
@@ -691,7 +692,7 @@
 ui.warn(onfailure % fd)
 return True, 1, False
 
-back = _makebackup(repo, ui, fcd, premerge)
+back = _makebackup(repo, ui, wctx, fcd, premerge)
 files = (None, None, None, back)
 r = 1
 try:
@@ -719,7 +720,7 @@
 return True, r, deleted
 finally:
 if not r and back is not None:
-util.unlink(back)
+back.remove()
 
 def _check(repo, r, ui, tool, fcd, files):
 fd = fcd.path()
@@ -741,7 +742,7 @@
 if not r and not checked and (_toolbool(ui, tool, "checkchanged") or
   'changed' in
   _toollist(ui, tool, "check")):
-if back is not None and filecmp.cmp(_workingpath(repo, fcd), back):
+if back is not None and not fcd.cmp(back):
 if ui.promptchoice(_(" output file %s appears unchanged\n"
  "was merge successful (yn)?"
  "$$  $$ ") % fd, 1):



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


D1058: context: add overlayfilectx.cmp()

2017-10-13 Thread phillco (Phil Cohen)
phillco 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/D1058

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -2089,6 +2089,9 @@
 self._parent = parent
 self._path = path
 
+def cmp(self, fctx):
+return self.data() != fctx.data()
+
 def ctx(self):
 return self._parent
 



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


D1059: filemerge: store backups in the overlayworkingctx if using imm

2017-10-13 Thread phillco (Phil Cohen)
phillco 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/D1059

AFFECTED FILES
  mercurial/filemerge.py

CHANGE DETAILS

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -604,9 +604,24 @@
 from . import context
 a = _workingpath(repo, fcd)
 back = scmutil.origpath(ui, repo, a)
-if premerge:
-util.copyfile(a, back)
-return context.arbitraryfilectx(back, repo=repo)
+inworkingdir = (back.startswith(repo.wvfs.base) and not
+back.startswith(repo.vfs.base))
+
+if isinstance(fcd, context.overlayworkingfilectx) and inworkingdir:
+# If the backup file is to be in the working directory, and we're
+# merging in-memory, we must redirect the backup to the memory context
+# so we don't disturb the working directory.
+relpath = back[len(repo.wvfs.base) + 1:]
+wctx[relpath].write(fcd.data(), fcd.flags())
+return wctx[relpath]
+else:
+# Otherwise, write to wherever the user specified the backups should 
go.
+#
+# A arbitraryfilectx is returned, so we can run the same functions on
+# the backup context regardless of where it lives.
+if premerge:
+util.copyfile(a, back)
+return context.arbitraryfilectx(back, repo=repo)
 
 def _maketempfiles(repo, fco, fca):
 """Writes out `fco` and `fca` as temporary files, so an external merge



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


D1056: context: add a fast-comparision path between arbitraryfilectx and workingfilectx

2017-10-13 Thread phillco (Phil Cohen)
phillco 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/D1056

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -8,6 +8,7 @@
 from __future__ import absolute_import
 
 import errno
+import filecmp
 import os
 import re
 import stat
@@ -2545,11 +2546,17 @@
 """Allows you to use filectx-like functions on a file in an arbitrary
 location on disk, possibly not in the working directory.
 """
-def __init__(self, path):
+def __init__(self, path, repo=None):
+# Repo is optional because contrib/simplemerge uses this class.
+self._repo = repo
 self._path = path
 
-def cmp(self, otherfilectx):
-return self.data() != otherfilectx.data()
+def cmp(self, fctx):
+if isinstance(fctx, workingfilectx) and self._repo:
+# Add a fast-path for merge if both sides are disk-backed.
+# Note that filecmp uses the opposite return values as cmp.
+return not filecmp.cmp(self.path(), self._repo.wjoin(fctx.path()))
+return self.data() != fctx.data()
 
 def path(self):
 return self._path



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


D1060: filemerge: add a missing flushall()

2017-10-13 Thread phillco (Phil Cohen)
phillco 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/D1060

AFFECTED FILES
  mercurial/filemerge.py

CHANGE DETAILS

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -467,6 +467,12 @@
 a = _workingpath(repo, fcd)
 fd = fcd.path()
 
+# Run ``flushall()`` to make any missing folders the following wwrite
+# calls might be depending on.
+from . import context
+if isinstance(fcd, context.overlayworkingfilectx):
+fcd.ctx().flushall()
+
 util.writefile(a + ".local", fcd.decodeddata())
 repo.wwrite(fd + ".other", fco.data(), fco.flags())
 repo.wwrite(fd + ".base", fca.data(), fca.flags())



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


D1046: tweakdefaults: enable rebase

2017-10-13 Thread durin42 (Augie Fackler)
durin42 requested changes to this revision.
durin42 added a comment.
This revision now requires changes to proceed.


  Actually, beyond that: if something is safe enough to be in tweakdefaults and 
it's not a BC change, it should *be on by default*. As such, turning on a 
command like rebase is IMO out of scope for tweakdefaults, and you should 
instead be having the discussion about what it takes to make rebase (and 
histedit) on by default.

REPOSITORY
  rHG Mercurial

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

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


Re: [PATCH 08 of 11] configitems: register the full 'merge-tools' config and sub-options

2017-10-13 Thread Augie Fackler
On Fri, Oct 13, 2017 at 07:55:14PM +0200, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld 
> # Date 1507487833 -7200
> #  Sun Oct 08 20:37:13 2017 +0200
> # Node ID 6ad9f6f42f33fe5efb78f76d39c41f28333144d6
> # Parent  0824a3519c14d643a81dd4f718846f15045772ec
> # EXP-Topic config.register.ready
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
> 6ad9f6f42f33
> configitems: register the full 'merge-tools' config and sub-options
>
> We register the merge-tools config section (which has an arbitrary base config
> value) and the possible sub-attribute. The sub-attribute has to be registered
> first or at the same time otherwise the '.*' item would shadow them.
>
> diff --git a/mercurial/configitems.py b/mercurial/configitems.py
> --- a/mercurial/configitems.py
> +++ b/mercurial/configitems.py
> @@ -498,6 +498,60 @@
>  coreconfigitem('merge', 'preferancestor',
>  default=lambda: ['*'],
>  )
> +coreconfigitem('merge-tools', '.*',
> +default=None,
> +generic=True,
> +)

Shouldn't this be [^.]*, since a . means a sub-attribute?

> +coreconfigitem('merge-tools', r'.*\.args$',
> +default="$local $base $other",
> +generic=True,
> +priority=-1,
> +)
> +coreconfigitem('merge-tools', r'.*\.binary$',
> +default=False,
> +generic=True,
> +priority=-1,
> +)
> +coreconfigitem('merge-tools', r'.*\.check$',
> +default=list,
> +generic=True,
> +priority=-1,
> +)
> +coreconfigitem('merge-tools', r'.*\.checkchanged$',
> +default=False,
> +generic=True,
> +priority=-1,
> +)
> +coreconfigitem('merge-tools', r'.*\.executable$',
> +default=dynamicdefault,
> +generic=True,
> +priority=-1,
> +)
> +coreconfigitem('merge-tools', r'.*\.fixeol$',
> +default=False,
> +generic=True,
> +priority=-1,
> +)
> +coreconfigitem('merge-tools', r'.*\.gui$',
> +default=False,
> +generic=True,
> +priority=-1,
> +)
> +coreconfigitem('merge-tools', r'.*\.priority$',
> +default=0,
> +generic=True,
> +priority=-1,
> +)
> +coreconfigitem('merge-tools', r'.*\.premerge$',
> +default=dynamicdefault,
> +generic=True,
> +priority=-1,
> +)
> +coreconfigitem('merge-tools', r'.*\.symlink$',
> +default=False,
> +generic=True,
> +priority=-1,
> +)
>  coreconfigitem('pager', 'ignore',
>  default=list,
>  )
> diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
> --- a/mercurial/filemerge.py
> +++ b/mercurial/filemerge.py
> @@ -30,16 +30,14 @@
>  util,
>  )
>
> -def _toolstr(ui, tool, part, default=""):
> -return ui.config("merge-tools", tool + "." + part, default)
> +def _toolstr(ui, tool, part, *args):
> +return ui.config("merge-tools", tool + "." + part, *args)
>
> -def _toolbool(ui, tool, part, default=False):
> -return ui.configbool("merge-tools", tool + "." + part, default)
> +def _toolbool(ui, tool, part,*args):
> +return ui.configbool("merge-tools", tool + "." + part, *args)
>
> -def _toollist(ui, tool, part, default=None):
> -if default is None:
> -default = []
> -return ui.configlist("merge-tools", tool + "." + part, default)
> +def _toollist(ui, tool, part):
> +return ui.configlist("merge-tools", tool + "." + part)
>
>  internals = {}
>  # Merge tools to document.
> @@ -187,8 +185,8 @@
>  for k, v in ui.configitems("merge-tools"):
>  t = k.split('.')[0]
>  if t not in tools:
> -tools[t] = int(_toolstr(ui, t, "priority", "0"))
> -if _toolbool(ui, t, "disabled", False):
> +tools[t] = int(_toolstr(ui, t, "priority"))
> +if _toolbool(ui, t, "disabled"):
>  disabled.add(t)
>  names = tools.keys()
>  tools = sorted([(-p, tool) for tool, p in tools.items()
> @@ -328,7 +326,7 @@
>  try:
>  premerge = _toolbool(ui, tool, "premerge", not binary)
>  except error.ConfigError:
> -premerge = _toolstr(ui, tool, "premerge").lower()
> +premerge = _toolstr(ui, tool, "premerge", "").lower()
>  if premerge not in validkeep:
>  _valid = ', '.join(["'" + v + "'" for v in validkeep])
>  raise error.ConfigError(_("%s.premerge not valid "
> @@ -503,7 +501,7 @@
> }
>  ui = repo.ui
>
> -args = _toolstr(ui, tool, "args", '$local $base $other')
> +args = _toolstr(ui, tool, "args")
>  if "$output" in args:
>  out, a = a, back # read input from backup, write to original
>  replace = {'local': a, 'base': b, 'other': c, 'output': out}
> ___
> 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

D1046: tweakdefaults: enable rebase

2017-10-13 Thread durin42 (Augie Fackler)
durin42 added a comment.


  Until we've got a plan for obsolete markers on by default (even if without 
marker exchange), I think I'd rather hold off on this.

REPOSITORY
  rHG Mercurial

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

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


D1047: tweakdefaults: add restack command

2017-10-13 Thread quark (Jun Wu)
quark added a comment.


  In https://phab.mercurial-scm.org/D1047#17639, @lothiraldan wrote:
  
  > But instead of having an alias, no matter how awesome it is that we can 
implement such command using only revsets, could we have it instead as a 
command? So we could add documentation and a proper help. I'm not sure that all 
end-users will be able to understand the revsets and I don't think the 
tweakdefaults comments will be available to them.
  
  
  I found the revset helpful for understanding what it does. I understand 
non-power users may feel differently.
  
  > I think that there were some discussions about some problems with pruned 
changeset, is there a scenario where restack fails or misbehave with pruned 
changesets?
  
  If you read the comment or the test, it's already handled by using 
`first(A+B)`.
  
  > Also as a user, I would like to restack only my current stack (no matter 
how it is defined) if I have other orphans changesets (like if parts of my 
changesets have been queued), I don't want them to be rebased while I'm working 
on something else.
  
  That's doable by changing `-r`.
  
  > With all these considerations, I would prefer to have restack as an 
experimental extension and not activated by default. We highlight it during 4.4 
announcement so people could test with their own workflow and gives feedback 
before activating it by default.
  
  That sounds okay. I'll move the code to `hgext`.

REPOSITORY
  rHG Mercurial

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

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


Warning: Freeze to start Tuesday

2017-10-13 Thread Augie Fackler
Ordinarily it'd be Monday, but I'll give y'all Monday to try and get 
last-minute features into 4.4. After that, please focus on bug fixes until 4.4 
final is released. Thanks!
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D1047: tweakdefaults: add restack command

2017-10-13 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  In https://phab.mercurial-scm.org/D1047#17639, @lothiraldan wrote:
  
  > I'm +1 for having stabilization command in core that handles 80% of the 
use-case which is mid-stack amend.
  >
  > But instead of having an alias, no matter how awesome it is that we can 
implement such command using only revsets, could we have it instead as a 
command? So we could add documentation and a proper help. I'm not sure that all 
end-users will be able to understand the revsets and I don't think the 
tweakdefaults comments will be available to them.
  >
  > I think that there were some discussions about some problems with pruned 
changeset, is there a scenario where restack fails or misbehave with pruned 
changesets?
  >
  > Also as a user, I would like to restack only my current stack (no matter 
how it is defined) if I have other orphans changesets (like if parts of my 
changesets have been queued), I don't want them to be rebased while I'm working 
on something else.
  >
  > With all these considerations, I would prefer to have restack as an 
experimental extension and not activated by default. We highlight it during 4.4 
announcement so people could test with their own workflow and gives feedback 
before activating it by default.
  
  
  I agree with all the above.

REPOSITORY
  rHG Mercurial

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

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


D1047: tweakdefaults: add restack command

2017-10-13 Thread lothiraldan (Boris Feld)
lothiraldan added a comment.


  I'm +1 for having stabilization command in core that handles 80% of the 
use-case which is mid-stack amend.
  
  But instead of having an alias, no matter how awesome it is that we can 
implement such command using only revsets, could we have it instead as a 
command? So we could add documentation and a proper help. I'm not sure that all 
end-users will be able to understand the revsets and I don't think the 
tweakdefaults comments will be available to them.
  
  I think that there were some discussions about some problems with pruned 
changeset, is there a scenario where restack fails or misbehave with pruned 
changesets?
  
  Also as a user, I would like to restack only my current stack (no matter how 
it is defined) if I have other orphans changesets (like if parts of my 
changesets have been queued), I don't want them to be rebased while I'm working 
on something else.
  
  With all these considerations, I would prefer to have restack as an 
experimental extension and not activated by default. We highlight it during 4.4 
announcement so people could test with their own workflow and gives feedback 
before activating it by default.

REPOSITORY
  rHG Mercurial

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

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


Re: [PATCH v2] transaction-summary: show the range of new revisions upon pull/unbundle (BC)

2017-10-13 Thread Augie Fackler

> On Oct 13, 2017, at 12:24, Kevin Bullock  
> wrote:
> 
>> On Oct 13, 2017, at 11:07, Augie Fackler  wrote:
>> 
>> On Fri, Oct 13, 2017 at 09:10:52AM +0200, Denis Laxalde wrote:
>>> Kevin Bullock a écrit :
> On Oct 12, 2017, at 03:13, Denis Laxalde  wrote:
> 
> # HG changeset patch
> # User Denis Laxalde 
> # Date 1507793990 -7200
> #  Thu Oct 12 09:39:50 2017 +0200
> # Node ID 48cca33a1b611c82a2bd72a2f72b80f321604f42
> # Parent  f1c2552c2de78a2f8a0c0ded099ccb200aad27d0
> # Available At http://hg.logilab.org/users/dlaxalde/hg
> #  hg pull http://hg.logilab.org/users/dlaxalde/hg -r 
> 48cca33a1b61
> # EXP-Topic pull-info-transaction
> transaction-summary: show the range of new revisions upon pull/unbundle 
> (BC)
> 
> Upon pull or unbundle, we display a message with the range of new 
> revisions
> fetched. This revision range could readily be used after a pull to look 
> out
> what's new with 'hg log'. The algorithm takes care of filtering "obsolete"
> revisions that might be present in transaction's "changes" but should not 
> be
> displayed to the end user.
 
 I like the idea, but it feels like it should be behind a config option 
 (which we can enable with ui.tweakdefaults) and/or -v/--verbose output. 
 Same thing we did when adding merge/rebase/etc. info to `hg status 
 --verbose`.
 
>>> 
>>> I don't quite understand why we'd want to hide this to the end user by
>>> default. If this is about UI, there are already other pieces of
>>> information that would be better for a --verbose output (e.g. the
>>> "adding changesets/manifests/file changes" or "added X changesets with Y
>>> changes to Z files"). Or is this about backwards compatibility?
>> 
>> I think Kevin is worried about BC here, but I know we've added at
>> least obsolete marker information in the past and it's been
>> okay. Probably the best thing to do where would be to make this
>> templated, so that in the future we can make it configurable to a
>> user's (or company's) preferences.
> 
> Correct, I was looking for precedent on how we've handled added output like 
> this. I don't feel strongly about it though -- I doubt many scripts are 
> actually parsing the output of pull. Making it templated is an interesting 
> option but I don't think it blocks landing this.

Per follow-up on IRC, I've queued this patch. Please feel *strongly* encouraged 
to make the post-pull summary templated!

> 
> 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 05 of 11 V2] templatekw: introduce obsfate keyword

2017-10-13 Thread Boris Feld
On Thu, 2017-10-12 at 22:51 +0900, Yuya Nishihara wrote:
> On Thu, 12 Oct 2017 15:29:31 +0200, Boris Feld wrote:
> > On Wed, 2017-10-11 at 22:24 +0900, Yuya Nishihara wrote:
> > > Ugh, there's templatekw.defaulttempl which provides the default
> > > template
> > > fragments to all stock/user templates. Maybe we can (ab)use it to
> > > define
> > > the default '{obsfate}' template.
> > > 
> > > I'm so sorry I didn't mention it before. It totally slipped my
> > > mind.
> > 
> > I saw templatekw.defaulttempl when working in this series but it
> > felt
> > like a big hack.
> > 
> > I tried to limit the number of places where obsfate is defined,
> > this
> > series already adds two obsfate definitions/implementations, the
> > changeset_printer and lobsfate in the default mapfile. I thought
> > adding
> > a third one in defaulttempl would complicate the potential update
> > of
> > obsfate output format.
> > 
> > I'm not an expert in the template engine, what benefits do you see
> > in
> > putting the obsfate definition in templatekw.defaulttempl?
> 
> That's more close to the end goal, right? We started off with a
> couple of
> building blocks to define {obsfate} in user template, because we
> don't want
> a monolithic {obsfate} keyword.
> 
> It would be nice if we could add "obsfate" to map-cmdline.default,
> which
> is the right way to define log templates, but IIRC you said you also
> wanted
> to reuse it in any user templates. So using defaulttempl seemed less
> bad.

I thought that keywords defined in map-cmdline.default were not
available in user-defined templates, I need to check that.

One thing that I would like is for the default obsfate templatekw to be
verbosity dependent, both in changing the fields that are shown (no
date except in verbose mode) and the content of the fields themselves
(if current user is the only one that touched a changeset and not in
verbose mode, don't show users).

Is it possible to have this verbosity dependent logic with templates?
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 03 of 11] configitems: register the 'color' section

2017-10-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1507625368 -7200
#  Tue Oct 10 10:49:28 2017 +0200
# Node ID 78e6b5c73ed70bd98a0aff7a4f1757a99ea11982
# Parent  19afa27ae88e1d42aa285d808a736d0c623bdf86
# EXP-Topic config.register.ready
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
78e6b5c73ed7
configitems: register the 'color' section

diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -160,6 +160,10 @@
 coreconfigitem('cmdserver', 'log',
 default=None,
 )
+coreconfigitem('color', '.*',
+default=None,
+generic=True,
+)
 coreconfigitem('color', 'mode',
 default='auto',
 )
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 06 of 11] configitems: register the 'extensions' section

2017-10-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1507625327 -7200
#  Tue Oct 10 10:48:47 2017 +0200
# Node ID 3885ce0a46c11f714335aafa38876b4d0c0aed9b
# Parent  a9c5344860a24f38007c9f25cb91a5304747391b
# EXP-Topic config.register.ready
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
3885ce0a46c1
configitems: register the 'extensions' section

diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -412,6 +412,10 @@
 coreconfigitem('experimental', 'updatecheck',
 default=None,
 )
+coreconfigitem('extensions', '.*',
+default=None,
+generic=True,
+)
 coreconfigitem('format', 'aggressivemergedeltas',
 default=False,
 )
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 05 of 11] configitems: register the 'defaults' section

2017-10-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1507487991 -7200
#  Sun Oct 08 20:39:51 2017 +0200
# Node ID a9c5344860a24f38007c9f25cb91a5304747391b
# Parent  863c2407bfabe9b23b28d01582f53d318b6ae9fc
# EXP-Topic config.register.ready
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
a9c5344860a2
configitems: register the 'defaults' section

diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -189,6 +189,10 @@
 coreconfigitem('debug', 'dirstate.delaywrite',
 default=0,
 )
+coreconfigitem('defaults', '.*',
+default=None,
+generic=True,
+)
 coreconfigitem('devel', 'all-warnings',
 default=False,
 )
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 02 of 11] configitems: register the 'alias' section

2017-10-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1507487185 -7200
#  Sun Oct 08 20:26:25 2017 +0200
# Node ID 19afa27ae88e1d42aa285d808a736d0c623bdf86
# Parent  429c6e9c7c3a4f601db17c6553a8fcdad35708a8
# EXP-Topic config.register.ready
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
19afa27ae88e
configitems: register the 'alias' section

diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -99,6 +99,10 @@
 
 coreconfigitem = getitemregister(coreitems)
 
+coreconfigitem('alias', '.*',
+default=None,
+generic=True,
+)
 coreconfigitem('annotate', 'nodates',
 default=None,
 )
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 11 of 11] configitems: register the 'templates' section

2017-10-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1507490964 -7200
#  Sun Oct 08 21:29:24 2017 +0200
# Node ID c577c2524d863b5649d31ad84a15773deb9b2372
# Parent  8f3e9e9a61021e35a5798eef6368672506890bcf
# EXP-Topic config.register.ready
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
c577c2524d86
configitems: register the 'templates' section

diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -716,6 +716,10 @@
 coreconfigitem('sparse', 'missingwarning',
 default=True,
 )
+coreconfigitem('templates', '.*',
+default=None,
+generic=True,
+)
 coreconfigitem('trusted', 'groups',
 default=list,
 )
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 09 of 11] configitems: register the 'pager.attend-.*' options

2017-10-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1507681569 -7200
#  Wed Oct 11 02:26:09 2017 +0200
# Node ID 9f8f4614d1366eaeea1366f9563a9db3a0811a9d
# Parent  6ad9f6f42f33fe5efb78f76d39c41f28333144d6
# EXP-Topic config.register.ready
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
9f8f4614d136
configitems: register the 'pager.attend-.*' options

diff --git a/hgext/pager.py b/hgext/pager.py
--- a/hgext/pager.py
+++ b/hgext/pager.py
@@ -56,8 +56,8 @@
 
 for cmd in cmds:
 var = 'attend-%s' % cmd
-if ui.config('pager', var):
-usepager = ui.configbool('pager', var)
+if ui.config('pager', var, None):
+usepager = ui.configbool('pager', var, True)
 break
 if (cmd in attend or
  (cmd not in ignore and not attend)):
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -552,6 +552,10 @@
 generic=True,
 priority=-1,
 )
+coreconfigitem('pager', 'attend-.*',
+default=dynamicdefault,
+generic=True,
+)
 coreconfigitem('pager', 'ignore',
 default=list,
 )
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 10 of 11] configitems: register the 'paths' config section

2017-10-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1507690915 -7200
#  Wed Oct 11 05:01:55 2017 +0200
# Node ID 8f3e9e9a61021e35a5798eef6368672506890bcf
# Parent  9f8f4614d1366eaeea1366f9563a9db3a0811a9d
# EXP-Topic config.register.ready
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
8f3e9e9a6102
configitems: register the 'paths' config section

diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -574,6 +574,10 @@
 coreconfigitem('paths', 'default-push',
 default=None,
 )
+coreconfigitem('paths', '.*',
+default=None,
+generic=True,
+)
 coreconfigitem('phases', 'checksubrepos',
 default='follow',
 )
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 08 of 11] configitems: register the full 'merge-tools' config and sub-options

2017-10-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1507487833 -7200
#  Sun Oct 08 20:37:13 2017 +0200
# Node ID 6ad9f6f42f33fe5efb78f76d39c41f28333144d6
# Parent  0824a3519c14d643a81dd4f718846f15045772ec
# EXP-Topic config.register.ready
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
6ad9f6f42f33
configitems: register the full 'merge-tools' config and sub-options

We register the merge-tools config section (which has an arbitrary base config
value) and the possible sub-attribute. The sub-attribute has to be registered
first or at the same time otherwise the '.*' item would shadow them.

diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -498,6 +498,60 @@
 coreconfigitem('merge', 'preferancestor',
 default=lambda: ['*'],
 )
+coreconfigitem('merge-tools', '.*',
+default=None,
+generic=True,
+)
+coreconfigitem('merge-tools', r'.*\.args$',
+default="$local $base $other",
+generic=True,
+priority=-1,
+)
+coreconfigitem('merge-tools', r'.*\.binary$',
+default=False,
+generic=True,
+priority=-1,
+)
+coreconfigitem('merge-tools', r'.*\.check$',
+default=list,
+generic=True,
+priority=-1,
+)
+coreconfigitem('merge-tools', r'.*\.checkchanged$',
+default=False,
+generic=True,
+priority=-1,
+)
+coreconfigitem('merge-tools', r'.*\.executable$',
+default=dynamicdefault,
+generic=True,
+priority=-1,
+)
+coreconfigitem('merge-tools', r'.*\.fixeol$',
+default=False,
+generic=True,
+priority=-1,
+)
+coreconfigitem('merge-tools', r'.*\.gui$',
+default=False,
+generic=True,
+priority=-1,
+)
+coreconfigitem('merge-tools', r'.*\.priority$',
+default=0,
+generic=True,
+priority=-1,
+)
+coreconfigitem('merge-tools', r'.*\.premerge$',
+default=dynamicdefault,
+generic=True,
+priority=-1,
+)
+coreconfigitem('merge-tools', r'.*\.symlink$',
+default=False,
+generic=True,
+priority=-1,
+)
 coreconfigitem('pager', 'ignore',
 default=list,
 )
diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -30,16 +30,14 @@
 util,
 )
 
-def _toolstr(ui, tool, part, default=""):
-return ui.config("merge-tools", tool + "." + part, default)
+def _toolstr(ui, tool, part, *args):
+return ui.config("merge-tools", tool + "." + part, *args)
 
-def _toolbool(ui, tool, part, default=False):
-return ui.configbool("merge-tools", tool + "." + part, default)
+def _toolbool(ui, tool, part,*args):
+return ui.configbool("merge-tools", tool + "." + part, *args)
 
-def _toollist(ui, tool, part, default=None):
-if default is None:
-default = []
-return ui.configlist("merge-tools", tool + "." + part, default)
+def _toollist(ui, tool, part):
+return ui.configlist("merge-tools", tool + "." + part)
 
 internals = {}
 # Merge tools to document.
@@ -187,8 +185,8 @@
 for k, v in ui.configitems("merge-tools"):
 t = k.split('.')[0]
 if t not in tools:
-tools[t] = int(_toolstr(ui, t, "priority", "0"))
-if _toolbool(ui, t, "disabled", False):
+tools[t] = int(_toolstr(ui, t, "priority"))
+if _toolbool(ui, t, "disabled"):
 disabled.add(t)
 names = tools.keys()
 tools = sorted([(-p, tool) for tool, p in tools.items()
@@ -328,7 +326,7 @@
 try:
 premerge = _toolbool(ui, tool, "premerge", not binary)
 except error.ConfigError:
-premerge = _toolstr(ui, tool, "premerge").lower()
+premerge = _toolstr(ui, tool, "premerge", "").lower()
 if premerge not in validkeep:
 _valid = ', '.join(["'" + v + "'" for v in validkeep])
 raise error.ConfigError(_("%s.premerge not valid "
@@ -503,7 +501,7 @@
}
 ui = repo.ui
 
-args = _toolstr(ui, tool, "args", '$local $base $other')
+args = _toolstr(ui, tool, "args")
 if "$output" in args:
 out, a = a, back # read input from backup, write to original
 replace = {'local': a, 'base': b, 'other': c, 'output': out}
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 01 of 11] configitems: allow for the registration of "generic" config item

2017-10-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1507625355 -7200
#  Tue Oct 10 10:49:15 2017 +0200
# Node ID 429c6e9c7c3a4f601db17c6553a8fcdad35708a8
# Parent  37b4375b1221e3bda055f0cbecf06b3c9510fd2c
# EXP-Topic config.register.ready
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
429c6e9c7c3a
configitems: allow for the registration of "generic" config item

Some section can contains arbitrary keys (eg: color, alias, extensions). We
add a way to register some generic config items for them. This is necessary to
get all the config registered. We use a regular expression because some sub-
attributes (eg: hooks.xxx.priority) can define default value on their own.

diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -8,6 +8,7 @@
 from __future__ import absolute_import
 
 import functools
+import re
 
 from . import (
 encoding,
@@ -33,20 +34,56 @@
 :section: the official config section where to find this item,
:name: the official name within the section,
 :default: default value for this item,
-:alias: optional list of tuples as alternatives.
+:alias: optional list of tuples as alternatives,
+:generic: this is a generic definition, match name using regular 
expression.
 """
 
-def __init__(self, section, name, default=None, alias=()):
+def __init__(self, section, name, default=None, alias=(),
+ generic=False, priority=0):
 self.section = section
 self.name = name
 self.default = default
 self.alias = list(alias)
+self.generic = generic
+self.priority = priority
+self._re = None
+if generic:
+self._re = re.compile(self.name)
+
+class itemregister(dict):
+"""A specialized dictionary that can handle wild-card selection"""
+
+def __init__(self):
+super(itemregister, self).__init__()
+self._generics = set()
+
+def update(self, other):
+super(itemregister, self).update(other)
+self._generics.update(other._generics)
+
+def __setitem__(self, key, item):
+super(itemregister, self).__setitem__(key, item)
+if item.generic:
+self._generics.add(item)
+
+def get(self, key):
+if key in self:
+return self[key]
+
+# search for a matching generic item
+generics = sorted(self._generics, key=(lambda x: (x.priority, x.name)))
+for item in generics:
+if item._re.match(key):
+return item
+
+# fallback to dict get
+return super(itemregister, self).get(key)
 
 coreitems = {}
 
 def _register(configtable, *args, **kwargs):
 item = configitem(*args, **kwargs)
-section = configtable.setdefault(item.section, {})
+section = configtable.setdefault(item.section, itemregister())
 if item.name in section:
 msg = "duplicated config item registration for '%s.%s'"
 raise error.ProgrammingError(msg % (item.section, item.name))
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 07 of 11] configitems: register the 'hooks' config section

2017-10-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1507905546 -7200
#  Fri Oct 13 16:39:06 2017 +0200
# Node ID 0824a3519c14d643a81dd4f718846f15045772ec
# Parent  3885ce0a46c11f714335aafa38876b4d0c0aed9b
# EXP-Topic config.register.ready
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
0824a3519c14
configitems: register the 'hooks' config section

diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -446,6 +446,10 @@
 coreconfigitem('format', 'usestore',
 default=True,
 )
+coreconfigitem('hooks', '.*',
+default=dynamicdefault,
+generic=True,
+)
 coreconfigitem('hostsecurity', 'ciphers',
 default=None,
 )
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 04 of 11] configitems: register the 'committemplate' section

2017-10-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1507489322 -7200
#  Sun Oct 08 21:02:02 2017 +0200
# Node ID 863c2407bfabe9b23b28d01582f53d318b6ae9fc
# Parent  78e6b5c73ed70bd98a0aff7a4f1757a99ea11982
# EXP-Topic config.register.ready
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
863c2407bfab
configitems: register the 'committemplate' section

diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -182,6 +182,10 @@
 coreconfigitem('commands', 'update.requiredest',
 default=False,
 )
+coreconfigitem('committemplate', '.*',
+default=None,
+generic=True,
+)
 coreconfigitem('debug', 'dirstate.delaywrite',
 default=0,
 )
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D1030: mpatch: switch alignment of wrapped line from tab to spaces with clang-format

2017-10-13 Thread ryanmce (Ryan McElroy)
ryanmce requested changes to this revision.
ryanmce added a comment.
This revision now requires changes to proceed.


  Seems like we should figure out the spacing stuff on 
https://phab.mercurial-scm.org/D1028 before moving forward here.

REPOSITORY
  rHG Mercurial

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

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


D1046: tweakdefaults: enable rebase

2017-10-13 Thread ryanmce (Ryan McElroy)
ryanmce accepted this revision as: ryanmce.
ryanmce added a comment.


  Accepting as myself (not as a reviewer though, since we're both FB). I'm a 
big +1 on this.

REPOSITORY
  rHG Mercurial

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

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


D1047: tweakdefaults: add restack command

2017-10-13 Thread quark (Jun Wu)
quark added a comment.


  In https://phab.mercurial-scm.org/D1047#17465, @dlax wrote:
  
  > As an end user, I'd probably not use this; it's too much magic.
  
  
  `restack` is used pretty frequently by internal users. I think it could be 
hard for some users (ex. designers) to understand the DAG, or know what to do 
after `hg amend` in the middle of a stack. So this command is pretty handy.
  
  I also think it's at least less magic than `evolve` since the it's just a 
plain rebase with a fancy revset (displayed when you run `--help`). Users 
understanding revsets could follow its logic and understand what it's doing.

INLINE COMMENTS

> dlax wrote in ui.py:56
> Maybe also explain what `ALLSRC` and `SRC` are.
> Also, it's not clear from reading this which "orphaned changesets" would be 
> rebased. All of them?

This will be explained in rebase command help text (by the time experimental 
flag gets removed).

> dlax wrote in ui.py:86
> Do we want to activate an experimental option in tweakdefaults?

I think it's fine since this is invisible to end-user. I also plan to remove 
the experimental flag soon(tm).

> dlax wrote in test-tweakdefaults-restack.t:28
> It's not obvious where wordking directory is, so maybe issue a `hg log -r .`

Working directory is `null`. Since `rebase` is expected to take care of working 
directory movement and that is covered by rebase tests, I think it's okay to 
not care about working directory here.

REPOSITORY
  rHG Mercurial

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

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


D1028: mpatch: reformat function prototypes with clang-format

2017-10-13 Thread ryanmce (Ryan McElroy)
ryanmce added a comment.


  I thought it was string that check-code doesn't fire on 
https://phab.mercurial-scm.org/D1030 but does fire here.
  
  It turns out that the check-code only finds spaces at the start of the line. 
So is you start with a tab and then spaces, that's fine. But if you start with 
spaces you trip up against test-check-code. In 
https://phab.mercurial-scm.org/D1030, the re-indented line start with a tab, 
whereas here the re-indented line is top-level so it starts with spaces.
  
  I, for one, am -1 on tabs but that's not a battle worth fighting probably. 
However, we can probably come up with a smarter test-check-code. If we're 
moving towards clang-format, it seems that the test-code should be checking 
that and not arbitrarily for spaces at the start of a line.

REPOSITORY
  rHG Mercurial

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

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


D1053: i18n: cache translated messages per encoding

2017-10-13 Thread yuja (Yuya Nishihara)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGd00ec62d156f: i18n: cache translated messages per encoding 
(authored by yuja, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1053?vs=2670=2694

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

AFFECTED FILES
  mercurial/i18n.py
  tests/test-i18n.t

CHANGE DETAILS

diff --git a/tests/test-i18n.t b/tests/test-i18n.t
--- a/tests/test-i18n.t
+++ b/tests/test-i18n.t
@@ -48,3 +48,23 @@
   $ $PYTHON check-translation.py *.po
   $ $PYTHON check-translation.py --doctest
   $ cd $TESTTMP
+
+Check i18n cache isn't reused after encoding change:
+
+  $ cat > $TESTTMP/encodingchange.py << EOF
+  > from mercurial import encoding, registrar
+  > from mercurial.i18n import _
+  > cmdtable = {}
+  > command = registrar.command(cmdtable)
+  > @command(b'encodingchange', norepo=True)
+  > def encodingchange(ui):
+  > for encode in (b'ascii', b'UTF-8', b'ascii', b'UTF-8'):
+  > encoding.encoding = encode
+  > ui.write(b'%s\n' % _(b'(EXPERIMENTAL)'))
+  > EOF
+
+  $ LANGUAGE=ja hg --config 
extensions.encodingchange=$TESTTMP/encodingchange.py encodingchange
+  (?)
+  (\xe5\xae\x9f\xe9\xa8\x93\xe7\x9a\x84\xe5\xae\x9f\xe8\xa3\x85) (esc)
+  (?)
+  (\xe5\xae\x9f\xe9\xa8\x93\xe7\x9a\x84\xe5\xae\x9f\xe8\xa3\x85) (esc)
diff --git a/mercurial/i18n.py b/mercurial/i18n.py
--- a/mercurial/i18n.py
+++ b/mercurial/i18n.py
@@ -58,7 +58,7 @@
 except AttributeError:
 _ugettext = t.gettext
 
-_msgcache = {}
+_msgcache = {}  # encoding: {message: translation}
 
 def gettext(message):
 """Translate message.
@@ -74,7 +74,8 @@
 if message is None or not _ugettext:
 return message
 
-if message not in _msgcache:
+cache = _msgcache.setdefault(encoding.encoding, {})
+if message not in cache:
 if type(message) is unicode:
 # goofy unicode docstrings in test
 paragraphs = message.split(u'\n\n')
@@ -90,11 +91,11 @@
 # the Python encoding defaults to 'ascii', this fails if the
 # translated string use non-ASCII characters.
 encodingstr = pycompat.sysstr(encoding.encoding)
-_msgcache[message] = u.encode(encodingstr, "replace")
+cache[message] = u.encode(encodingstr, "replace")
 except LookupError:
 # An unknown encoding results in a LookupError.
-_msgcache[message] = message
-return _msgcache[message]
+cache[message] = message
+return cache[message]
 
 def _plain():
 if ('HGPLAIN' not in encoding.environ



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


D1053: i18n: cache translated messages per encoding

2017-10-13 Thread ryanmce (Ryan McElroy)
ryanmce accepted this revision.
ryanmce added a comment.
This revision is now accepted and ready to land.


  queued

REPOSITORY
  rHG Mercurial

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

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


D958: i18n: clean msgcache when encoding changes

2017-10-13 Thread quark (Jun Wu)
quark abandoned this revision.
quark added a comment.


  https://phab.mercurial-scm.org/D1053 is a cleaner fix.

REPOSITORY
  rHG Mercurial

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

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


D1053: i18n: cache translated messages per encoding

2017-10-13 Thread quark (Jun Wu)
quark accepted this revision.
quark added a comment.


  I like this approach. Thanks!

REPOSITORY
  rHG Mercurial

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

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


Re: [PATCH 4 of 4] templater: fix ifcontains() to handle type mismatch gracefully

2017-10-13 Thread Augie Fackler
On Thu, Oct 12, 2017 at 10:55:44PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1507813751 -32400
> #  Thu Oct 12 22:09:11 2017 +0900
> # Node ID 26273fe219811ac0e87f030a2d9c8ed50f4f4768
> # Parent  b770d50a3c6256008a6ed6614b21f27e1a09df1b
> templater: fix ifcontains() to handle type mismatch gracefully

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


Re: [PATCH v2] transaction-summary: show the range of new revisions upon pull/unbundle (BC)

2017-10-13 Thread Kevin Bullock
> On Oct 13, 2017, at 11:07, Augie Fackler  wrote:
> 
> On Fri, Oct 13, 2017 at 09:10:52AM +0200, Denis Laxalde wrote:
>> Kevin Bullock a écrit :
 On Oct 12, 2017, at 03:13, Denis Laxalde  wrote:
 
 # HG changeset patch
 # User Denis Laxalde 
 # Date 1507793990 -7200
 #  Thu Oct 12 09:39:50 2017 +0200
 # Node ID 48cca33a1b611c82a2bd72a2f72b80f321604f42
 # Parent  f1c2552c2de78a2f8a0c0ded099ccb200aad27d0
 # Available At http://hg.logilab.org/users/dlaxalde/hg
 #  hg pull http://hg.logilab.org/users/dlaxalde/hg -r 
 48cca33a1b61
 # EXP-Topic pull-info-transaction
 transaction-summary: show the range of new revisions upon pull/unbundle 
 (BC)
 
 Upon pull or unbundle, we display a message with the range of new revisions
 fetched. This revision range could readily be used after a pull to look out
 what's new with 'hg log'. The algorithm takes care of filtering "obsolete"
 revisions that might be present in transaction's "changes" but should not 
 be
 displayed to the end user.
>>> 
>>> I like the idea, but it feels like it should be behind a config option 
>>> (which we can enable with ui.tweakdefaults) and/or -v/--verbose output. 
>>> Same thing we did when adding merge/rebase/etc. info to `hg status 
>>> --verbose`.
>>> 
>> 
>> I don't quite understand why we'd want to hide this to the end user by
>> default. If this is about UI, there are already other pieces of
>> information that would be better for a --verbose output (e.g. the
>> "adding changesets/manifests/file changes" or "added X changesets with Y
>> changes to Z files"). Or is this about backwards compatibility?
> 
> I think Kevin is worried about BC here, but I know we've added at
> least obsolete marker information in the past and it's been
> okay. Probably the best thing to do where would be to make this
> templated, so that in the future we can make it configurable to a
> user's (or company's) preferences.

Correct, I was looking for precedent on how we've handled added output like 
this. I don't feel strongly about it though -- I doubt many scripts are 
actually parsing the output of pull. Making it templated is an interesting 
option but I don't think it blocks landing this.

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] chg: remove outdated rule to start test server

2017-10-13 Thread Augie Fackler
On Thu, Oct 12, 2017 at 10:56:35PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1507814474 -32400
> #  Thu Oct 12 22:21:14 2017 +0900
> # Node ID 9b41113b9c4397dec6bb198973a8231533f56bce
> # Parent  26273fe219811ac0e87f030a2d9c8ed50f4f4768
> chg: remove outdated rule to start test server

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


Re: [PATCH 2 of 2] configitems: drop redundant default of web.allow

2017-10-13 Thread Augie Fackler
On Fri, Oct 13, 2017 at 12:37:18AM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1507821774 -32400
> #  Fri Oct 13 00:22:54 2017 +0900
> # Node ID 50217bf3f4f143488d91cce177f5447115b5277e
> # Parent  69b2780c454aa671eab506050f0dca555f40ee62
> configitems: drop redundant default of web.allow

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


Re: [PATCH] build: no need to build zstd in the bootstrap phase of a deb/rpm build

2017-10-13 Thread Augie Fackler
On Thu, Oct 12, 2017 at 09:09:26PM +0200, muxator via Mercurial-devel wrote:
> # HG changeset patch
> # User muxator 
> # Date 1507834828 -7200
> #  Thu Oct 12 21:00:28 2017 +0200
> # Node ID f91472aa5015bd16b8585e53ba34d64a7a05c8c7
> # Parent  7259f0ddfc0f18138420e7c9c7e4145a25016d7b
> build: no need to build zstd in the bootstrap phase of a deb/rpm build
>
> When bootstrapping a deb/rpm build, packagelib.sh starts performing a local
> build for the sole purpose of parsing the output of "hg version".
> Then it "hg archive"s the source code, and builds everything again.
>
> For that initial initial step, there is no purpose in compiling zstdlib.
> This commit adds another target "make local-no-zstd", which is called by
> packagelib.sh for the initial bootstrapping.
>
> On my personal system, this cuts down 20 seconds for a package build (the
> bootstrapping build goes from ~30 to ~10 seconds).
>
> diff --git a/Makefile b/Makefile
> --- a/Makefile
> +++ b/Makefile
> @@ -44,14 +44,20 @@
>
>  all: build doc
>
> -local:
> +local-inner:
>   $(PYTHON) setup.py $(PURE) \
> build_py -c -d . \
> -   build_ext $(COMPILERFLAG) -i \
> +   build_ext $(COMPILERFLAG) $(ZSTD) -i \
> build_hgexe $(COMPILERFLAG) -i \
> build_mo
>   env HGRCPATH= $(PYTHON) hg version
>
> +local: ZSTD=--zstd
> +local: local-inner
> +
> +local-no-zstd: ZSTD=--no-zstd
> +local-no-zstd: local-inner

Could we skip the addition of the local-no-zstd thing, and make the
ZSTD var default to --zstd, and then in the packagelib script we can
jsut do `make local ZSTD=--no-zstd` instead?

> +
>  build:
>   $(PYTHON) setup.py $(PURE) build $(COMPILERFLAG)
>
> @@ -303,7 +309,8 @@
>  linux-wheels-i686:
>   docker run -e "HGTEST_JOBS=$(shell nproc)" --rm -ti -v `pwd`:/src 
> quay.io/pypa/manylinux1_i686 linux32 /src/contrib/build-linux-wheels.sh
>
> -.PHONY: help all local build doc cleanbutpackages clean install install-bin \
> +.PHONY: help all local local-inner local-no-zstd build doc \
> + cleanbutpackages clean install install-bin \
>   install-doc install-home install-home-bin install-home-doc \
>   dist dist-notests check tests check-code update-pot \
>   osx deb ppa docker-debian-jessie docker-debian-stretch \
> diff --git a/contrib/packagelib.sh b/contrib/packagelib.sh
> --- a/contrib/packagelib.sh
> +++ b/contrib/packagelib.sh
> @@ -9,7 +9,7 @@
>  # node: the node|short hg was built from, or empty if built from a tag
>  gethgversion() {
>  make cleanbutpackages
> -make local || make local PURE=--pure
> +make local-no-zstd || make local-no-zstd PURE=--pure
>  HG="$PWD/hg"
>
>  $HG version > /dev/null || { echo 'abort: hg version failed!'; exit 1 ; }
> ___
> 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] transaction-summary: show the range of new revisions upon pull/unbundle (BC)

2017-10-13 Thread Augie Fackler
On Fri, Oct 13, 2017 at 09:10:52AM +0200, Denis Laxalde wrote:
> Kevin Bullock a écrit :
> > > On Oct 12, 2017, at 03:13, Denis Laxalde  wrote:
> > >
> > > # HG changeset patch
> > > # User Denis Laxalde 
> > > # Date 1507793990 -7200
> > > #  Thu Oct 12 09:39:50 2017 +0200
> > > # Node ID 48cca33a1b611c82a2bd72a2f72b80f321604f42
> > > # Parent  f1c2552c2de78a2f8a0c0ded099ccb200aad27d0
> > > # Available At http://hg.logilab.org/users/dlaxalde/hg
> > > #  hg pull http://hg.logilab.org/users/dlaxalde/hg -r 
> > > 48cca33a1b61
> > > # EXP-Topic pull-info-transaction
> > > transaction-summary: show the range of new revisions upon pull/unbundle 
> > > (BC)
> > >
> > > Upon pull or unbundle, we display a message with the range of new 
> > > revisions
> > > fetched. This revision range could readily be used after a pull to look 
> > > out
> > > what's new with 'hg log'. The algorithm takes care of filtering "obsolete"
> > > revisions that might be present in transaction's "changes" but should not 
> > > be
> > > displayed to the end user.
> >
> > I like the idea, but it feels like it should be behind a config option 
> > (which we can enable with ui.tweakdefaults) and/or -v/--verbose output. 
> > Same thing we did when adding merge/rebase/etc. info to `hg status 
> > --verbose`.
> >
>
> I don't quite understand why we'd want to hide this to the end user by
> default. If this is about UI, there are already other pieces of
> information that would be better for a --verbose output (e.g. the
> "adding changesets/manifests/file changes" or "added X changesets with Y
> changes to Z files"). Or is this about backwards compatibility?

I think Kevin is worried about BC here, but I know we've added at
least obsolete marker information in the past and it's been
okay. Probably the best thing to do where would be to make this
templated, so that in the future we can make it configurable to a
user's (or company's) preferences.

> That being said, I'm very open to any option that'd make this land, even
> if it requires "hidding" the feature... The tweakdefaults idea sounds
> more interesting than the --verbose one.

I'm fine to land this in tweakdefaults - my (personal) goal is to move
tweakdefaults to on-by-default in early 2018, so maybe that's good enough.

I'm +1 to land this patch as-is (after having reflected on it), but
would also be fine to land it inside tweakdefaults.

> ___
> 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


  1   2   >