Re: [PATCH 3 of 5 STABLE] tests: add test-commit-interactive-curses.t "require tic" for test portability

2016-10-28 Thread Yuya Nishihara
On Sat, 29 Oct 2016 03:16:48 +0900, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori 
> # Date 1477678088 -32400
> #  Sat Oct 29 03:08:08 2016 +0900
> # Branch stable
> # Node ID 141cb12c0175d9e4fbdab1f69d99be24d50ce3f4
> # Parent  fe612ab5eeff700b808a1d85013fa3472517a3d6
> tests: add test-commit-interactive-curses.t "require tic" for test portability
> 
> Standard library of Python on Windows doesn't have curses module.

Queued the first three, thanks.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 3 of 3 evolve-ext] errors: add missing imports of mercurial.error

2016-10-28 Thread Martin von Zweigbergk via Mercurial-devel
On Fri, Oct 28, 2016 at 5:52 PM, Pierre-Yves David
 wrote:
>
>
> On 10/29/2016 02:27 AM, Martin von Zweigbergk wrote:
>>
>> # HG changeset patch
>> # User Martin von Zweigbergk 
>> # Date 1477700706 25200
>> #  Fri Oct 28 17:25:06 2016 -0700
>> # Branch stable
>> # Node ID 406fdf786dfa126734afa38bb1da8050633921b7
>> # Parent  961b53077cabab1d8ed5e09c3eebd07ae7083ee5
>> errors: add missing imports of mercurial.error
>
>
> patches 1 and 2 pushed. What is this one about‽

What it says on the box: adding missing imports of mercurial.error.
Was there an implied question too? I did look to me like they were
missing.

>
>
>>
>> diff -r 961b53077cab -r 406fdf786dfa hgext/obsolete.py
>> --- a/hgext/obsolete.py Fri Oct 28 17:15:57 2016 -0700
>> +++ b/hgext/obsolete.py Fri Oct 28 17:25:06 2016 -0700
>> @@ -13,7 +13,7 @@
>>  were such user.
>>  """
>>
>> -from mercurial import util
>> +from mercurial import error
>>
>>  try:
>>  from mercurial import obsolete
>> @@ -24,9 +24,9 @@
>>  import json
>>
>>  from mercurial import cmdutil
>> -from mercurial import error
>>  from mercurial.i18n import _
>>  from mercurial.node import bin, nullid
>> +from mercurial import util
>>
>>
>>  #
>> diff -r 961b53077cab -r 406fdf786dfa hgext/pushexperiment.py
>> --- a/hgext/pushexperiment.py   Fri Oct 28 17:15:57 2016 -0700
>> +++ b/hgext/pushexperiment.py   Fri Oct 28 17:25:06 2016 -0700
>> @@ -12,6 +12,7 @@
>>  from StringIO import StringIO
>>
>>  from mercurial.i18n import _
>> +from mercurial import error
>>  from mercurial import extensions
>>  from mercurial import wireproto
>>  from mercurial import obsolete
>> diff -r 961b53077cab -r 406fdf786dfa hgext/simple4server.py
>> --- a/hgext/simple4server.pyFri Oct 28 17:15:57 2016 -0700
>> +++ b/hgext/simple4server.pyFri Oct 28 17:25:06 2016 -0700
>> @@ -15,6 +15,7 @@
>>
>>  import hashlib
>>  import struct
>> +from mercurial import error
>>  from mercurial import util
>>  from mercurial import wireproto
>>  from mercurial import extensions
>>
>
> --
> Pierre-Yves David
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 3 of 3 evolve-ext] errors: add missing imports of mercurial.error

2016-10-28 Thread Pierre-Yves David



On 10/29/2016 02:27 AM, Martin von Zweigbergk wrote:

# HG changeset patch
# User Martin von Zweigbergk 
# Date 1477700706 25200
#  Fri Oct 28 17:25:06 2016 -0700
# Branch stable
# Node ID 406fdf786dfa126734afa38bb1da8050633921b7
# Parent  961b53077cabab1d8ed5e09c3eebd07ae7083ee5
errors: add missing imports of mercurial.error


patches 1 and 2 pushed. What is this one about‽



diff -r 961b53077cab -r 406fdf786dfa hgext/obsolete.py
--- a/hgext/obsolete.py Fri Oct 28 17:15:57 2016 -0700
+++ b/hgext/obsolete.py Fri Oct 28 17:25:06 2016 -0700
@@ -13,7 +13,7 @@
 were such user.
 """

-from mercurial import util
+from mercurial import error

 try:
 from mercurial import obsolete
@@ -24,9 +24,9 @@
 import json

 from mercurial import cmdutil
-from mercurial import error
 from mercurial.i18n import _
 from mercurial.node import bin, nullid
+from mercurial import util


 #
diff -r 961b53077cab -r 406fdf786dfa hgext/pushexperiment.py
--- a/hgext/pushexperiment.py   Fri Oct 28 17:15:57 2016 -0700
+++ b/hgext/pushexperiment.py   Fri Oct 28 17:25:06 2016 -0700
@@ -12,6 +12,7 @@
 from StringIO import StringIO

 from mercurial.i18n import _
+from mercurial import error
 from mercurial import extensions
 from mercurial import wireproto
 from mercurial import obsolete
diff -r 961b53077cab -r 406fdf786dfa hgext/simple4server.py
--- a/hgext/simple4server.pyFri Oct 28 17:15:57 2016 -0700
+++ b/hgext/simple4server.pyFri Oct 28 17:25:06 2016 -0700
@@ -15,6 +15,7 @@

 import hashlib
 import struct
+from mercurial import error
 from mercurial import util
 from mercurial import wireproto
 from mercurial import extensions



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


[PATCH 1 of 3 evolve-ext] evolve: prefer "abort" over "abandon" in messages for consistency

2016-10-28 Thread Martin von Zweigbergk via Mercurial-devel
# HG changeset patch
# User Martin von Zweigbergk 
# Date 1477699903 25200
#  Fri Oct 28 17:11:43 2016 -0700
# Branch stable
# Node ID 21e8cc0e6fafd8d11e63e745f1667c40a262b8df
# Parent  c9ddc93eee67de7787133c725971e9bc108c3e93
evolve: prefer "abort" over "abandon" in messages for consistency

diff -r c9ddc93eee67 -r 21e8cc0e6faf hgext/evolve.py
--- a/hgext/evolve.py   Fri Oct 28 15:17:27 2016 -0700
+++ b/hgext/evolve.py   Fri Oct 28 17:11:43 2016 -0700
@@ -2148,7 +2148,7 @@
 hg._showstats(repo, stats)
 if stats[3]:
 repo.ui.status(_("use 'hg resolve' to retry unresolved file merges "
- "or 'hg update -C .' to abandon\n"))
+ "or 'hg update -C .' to abort\n"))
 if stats[3] > 0:
 raise error.Abort('merge conflict between several amendments '
 '(this is not automated yet)',
diff -r c9ddc93eee67 -r 21e8cc0e6faf tests/test-stabilize-result.t
--- a/tests/test-stabilize-result.t Fri Oct 28 15:17:27 2016 -0700
+++ b/tests/test-stabilize-result.t Fri Oct 28 17:11:43 2016 -0700
@@ -359,7 +359,7 @@
   merging a
   warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
   0 files updated, 0 files merged, 0 files removed, 1 files unresolved
-  use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to 
abandon
+  use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abort
   abort: merge conflict between several amendments (this is not automated yet)
   (/!\ You can try:
   /!\ * manual merge + resolve => new cset X
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 3 evolve-ext] evolve: use single quotes in usage messages

2016-10-28 Thread Martin von Zweigbergk via Mercurial-devel
# HG changeset patch
# User Martin von Zweigbergk 
# Date 1477700157 25200
#  Fri Oct 28 17:15:57 2016 -0700
# Branch stable
# Node ID 961b53077cabab1d8ed5e09c3eebd07ae7083ee5
# Parent  21e8cc0e6fafd8d11e63e745f1667c40a262b8df
evolve: use single quotes in usage messages

Mercurial core has moved in this direction, so let's follow.

diff -r 21e8cc0e6faf -r 961b53077cab hgext/evolve.py
--- a/hgext/evolve.py   Fri Oct 28 17:11:43 2016 -0700
+++ b/hgext/evolve.py   Fri Oct 28 17:15:57 2016 -0700
@@ -689,7 +689,7 @@
 if repo['.'].obsolete():
 ui.warn(_('working directory parent is obsolete!\n'))
 if (not ui.quiet) and obsolete.isenabled(repo, commandopt):
-ui.warn(_('(use "hg evolve" to update to its successor)\n'))
+ui.warn(_("(use 'hg evolve' to update to its successor)\n"))
 
 @eh.wrapcommand("update")
 @eh.wrapcommand("pull")
@@ -1945,8 +1945,8 @@
 _evolvestatewrite(repo, {'current': orig.node()})
 repo.ui.write_err(_('evolve failed!\n'))
 repo.ui.write_err(
-_('fix conflict and run "hg evolve --continue"'
-  ' or use "hg update -C ." to abort\n'))
+_("fix conflict and run 'hg evolve --continue'"
+  " or use 'hg update -C .' to abort\n"))
 raise
 
 def _solvebumped(ui, repo, bumped, dryrun=False, confirm=False,
@@ -2002,7 +2002,7 @@
 repo.opener.write('graftstate', bumped.hex() + '\n')
 repo.ui.write_err(_('evolution failed!\n'))
 repo.ui.write_err(
-_('fix conflict and run "hg evolve --continue"\n'))
+_("fix conflict and run 'hg evolve --continue'\n"))
 raise
 # Create the new commit context
 repo.ui.status(_('computing new diff\n'))
@@ -2364,7 +2364,7 @@
 ui.warn(_("ambigious next (unstable) changeset:\n"))
 for c in aspchildren:
 displayer.show(repo[c])
-ui.warn(_('(run "hg evolve --rev REV" on one of them)\n'))
+ui.warn(_("(run 'hg evolve --rev REV' on one of them)\n"))
 return 1
 else:
 cmdutil.bailifchanged(repo)
@@ -2508,7 +2508,7 @@
 if not cp.mutable():
 # note: createmarkers() would have raised something anyway
 raise error.Abort('cannot prune immutable changeset: %s' % cp,
- hint='see "hg help phases" for details')
+ hint="see 'hg help phases' for details")
 precs.append(cp)
 if not precs:
 raise error.Abort('nothing to prune')
@@ -2832,7 +2832,7 @@
 updatebookmarks(newid)
 if not repo[newid].files():
 ui.warn(_("new changeset is empty\n"))
-ui.status(_('(use "hg prune ." to remove it)\n'))
+ui.status(_("(use 'hg prune .' to remove it)\n"))
 tr.close()
 finally:
 lockmod.release(tr, lock, wlock)
diff -r 21e8cc0e6faf -r 961b53077cab tests/test-evolve.t
--- a/tests/test-evolve.t   Fri Oct 28 17:11:43 2016 -0700
+++ b/tests/test-evolve.t   Fri Oct 28 17:15:57 2016 -0700
@@ -115,7 +115,7 @@
   1 public 
   $ hg prune 1
   abort: cannot prune immutable changeset: 7c3bad9141dc
-  (see "hg help phases" for details)
+  (see 'hg help phases' for details)
   [255]
   $ hg log -r 1 --template '{rev} {phase} {obsolete}\n'
   1 public 
@@ -1248,7 +1248,7 @@
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg uncommit --all
   new changeset is empty
-  (use "hg prune ." to remove it)
+  (use 'hg prune .' to remove it)
   $ glog -r "18::"
   @  26:044804d0c10d@default(draft) add j1
   |
@@ -1435,7 +1435,7 @@
   merging newfile
   warning: conflicts while merging newfile! (edit, then use 'hg resolve 
--mark')
   evolve failed!
-  fix conflict and run "hg evolve --continue" or use "hg update -C ." to abort
+  fix conflict and run 'hg evolve --continue' or use 'hg update -C .' to abort
   abort: unresolved merge conflicts (see hg help resolve)
   [255]
 
diff -r 21e8cc0e6faf -r 961b53077cab tests/test-obsolete.t
--- a/tests/test-obsolete.t Fri Oct 28 17:11:43 2016 -0700
+++ b/tests/test-obsolete.t Fri Oct 28 17:15:57 2016 -0700
@@ -131,7 +131,7 @@
   summary: add obsol_c
   
   working directory parent is obsolete!
-  (use "hg evolve" to update to its successor)
+  (use 'hg evolve' to update to its successor)
   $ mkcommit d # 5 (on 3)
   1 new unstable changesets
   $ qlog -r 'obsolete()'
@@ -701,7 +701,7 @@
   $ hg up --hidden 2
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
   working directory parent is obsolete!
-  (use "hg evolve" to update to its successor)
+  (use 'hg evolve' to update to its successor)
   $ hg export 9468a5f5d8b2 | hg import -
   applying patch from stdin
   1 new unstable changesets
diff -r 21e8cc0e6faf -r 

[PATCH 3 of 3 evolve-ext] errors: add missing imports of mercurial.error

2016-10-28 Thread Martin von Zweigbergk via Mercurial-devel
# HG changeset patch
# User Martin von Zweigbergk 
# Date 1477700706 25200
#  Fri Oct 28 17:25:06 2016 -0700
# Branch stable
# Node ID 406fdf786dfa126734afa38bb1da8050633921b7
# Parent  961b53077cabab1d8ed5e09c3eebd07ae7083ee5
errors: add missing imports of mercurial.error

diff -r 961b53077cab -r 406fdf786dfa hgext/obsolete.py
--- a/hgext/obsolete.py Fri Oct 28 17:15:57 2016 -0700
+++ b/hgext/obsolete.py Fri Oct 28 17:25:06 2016 -0700
@@ -13,7 +13,7 @@
 were such user.
 """
 
-from mercurial import util
+from mercurial import error
 
 try:
 from mercurial import obsolete
@@ -24,9 +24,9 @@
 import json
 
 from mercurial import cmdutil
-from mercurial import error
 from mercurial.i18n import _
 from mercurial.node import bin, nullid
+from mercurial import util
 
 
 #
diff -r 961b53077cab -r 406fdf786dfa hgext/pushexperiment.py
--- a/hgext/pushexperiment.py   Fri Oct 28 17:15:57 2016 -0700
+++ b/hgext/pushexperiment.py   Fri Oct 28 17:25:06 2016 -0700
@@ -12,6 +12,7 @@
 from StringIO import StringIO
 
 from mercurial.i18n import _
+from mercurial import error
 from mercurial import extensions
 from mercurial import wireproto
 from mercurial import obsolete
diff -r 961b53077cab -r 406fdf786dfa hgext/simple4server.py
--- a/hgext/simple4server.pyFri Oct 28 17:15:57 2016 -0700
+++ b/hgext/simple4server.pyFri Oct 28 17:25:06 2016 -0700
@@ -15,6 +15,7 @@
 
 import hashlib
 import struct
+from mercurial import error
 from mercurial import util
 from mercurial import wireproto
 from mercurial import extensions
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 3 of 3 evolve-ext] evolve: make error message consistent

2016-10-28 Thread Martin von Zweigbergk via Mercurial-devel
On Fri, Oct 28, 2016 at 5:01 PM, Pierre-Yves David
 wrote:
>
>
> On 10/29/2016 12:22 AM, Martin von Zweigbergk via Mercurial-devel wrote:
>>
>> # HG changeset patch
>> # User Martin von Zweigbergk 
>> # Date 1477692293 25200
>> #  Fri Oct 28 15:04:53 2016 -0700
>> # Node ID fc367693739cb18b04336609d65d659b0d4f49b7
>> # Parent  8f59ce14ebb1864eb750a4d3a8c6a9b486aab074
>> evolve: make error message consistent
>>
>> We should use double quotes around commands consistently. Also use
>> "abort" instead of "abandon" for consistency.
>
>
> +1 for the abort → abandon change.
>
> However, I think timeless (or someone) have been working the other way to
> replace all " with ' Can I get you to do the opposite change?

Oops, I didn't look closely enough at what was there in hg core. Will
send an update.

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


Re: [PATCH 2 of 3 evolve-ext] setupevolveunfinished: use "hg update -C ." to abort

2016-10-28 Thread Pierre-Yves David



On 10/29/2016 12:22 AM, Martin von Zweigbergk via Mercurial-devel wrote:

# HG changeset patch
# User Martin von Zweigbergk 
# Date 1477693047 25200
#  Fri Oct 28 15:17:27 2016 -0700
# Node ID 8f59ce14ebb1864eb750a4d3a8c6a9b486aab074
# Parent  d776bbaebc34ff7b0a7e822a1fb2f6ea25a5adfa
setupevolveunfinished: use "hg update -C ." to abort


I've pushed patches 1 and 2, many thanks.

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


Re: [PATCH 3 of 3 evolve-ext] evolve: make error message consistent

2016-10-28 Thread Pierre-Yves David



On 10/29/2016 12:22 AM, Martin von Zweigbergk via Mercurial-devel wrote:

# HG changeset patch
# User Martin von Zweigbergk 
# Date 1477692293 25200
#  Fri Oct 28 15:04:53 2016 -0700
# Node ID fc367693739cb18b04336609d65d659b0d4f49b7
# Parent  8f59ce14ebb1864eb750a4d3a8c6a9b486aab074
evolve: make error message consistent

We should use double quotes around commands consistently. Also use
"abort" instead of "abandon" for consistency.


+1 for the abort → abandon change.

However, I think timeless (or someone) have been working the other way 
to replace all " with ' Can I get you to do the opposite change?


Cheers,

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


[PATCH 3 of 3 evolve-ext] evolve: make error message consistent

2016-10-28 Thread Martin von Zweigbergk via Mercurial-devel
# HG changeset patch
# User Martin von Zweigbergk 
# Date 1477692293 25200
#  Fri Oct 28 15:04:53 2016 -0700
# Node ID fc367693739cb18b04336609d65d659b0d4f49b7
# Parent  8f59ce14ebb1864eb750a4d3a8c6a9b486aab074
evolve: make error message consistent

We should use double quotes around commands consistently. Also use
"abort" instead of "abandon" for consistency.

diff -r 8f59ce14ebb1 -r fc367693739c hgext/evolve.py
--- a/hgext/evolve.py   Fri Oct 28 15:17:27 2016 -0700
+++ b/hgext/evolve.py   Fri Oct 28 15:04:53 2016 -0700
@@ -2147,8 +2147,8 @@
 
 hg._showstats(repo, stats)
 if stats[3]:
-repo.ui.status(_("use 'hg resolve' to retry unresolved file merges "
- "or 'hg update -C .' to abandon\n"))
+repo.ui.status(_('use "hg resolve" to retry unresolved file merges '
+ 'or "hg update -C ." to abort\n'))
 if stats[3] > 0:
 raise error.Abort('merge conflict between several amendments '
 '(this is not automated yet)',
@@ -4044,7 +4044,7 @@
 @eh.uisetup
 def setupevolveunfinished(ui):
 data = ('evolvestate', True, False, _('evolve in progress'),
-   _("use 'hg evolve --continue' or 'hg update -C .' to abort"))
+   _('use "hg evolve --continue" or "hg update -C ." to abort'))
 cmdutil.unfinishedstates.append(data)
 
 @eh.wrapfunction(hg, 'clean')
diff -r 8f59ce14ebb1 -r fc367693739c tests/test-stabilize-result.t
--- a/tests/test-stabilize-result.t Fri Oct 28 15:17:27 2016 -0700
+++ b/tests/test-stabilize-result.t Fri Oct 28 15:04:53 2016 -0700
@@ -359,7 +359,7 @@
   merging a
   warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
   0 files updated, 0 files merged, 0 files removed, 1 files unresolved
-  use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to 
abandon
+  use "hg resolve" to retry unresolved file merges or "hg update -C ." to abort
   abort: merge conflict between several amendments (this is not automated yet)
   (/!\ You can try:
   /!\ * manual merge + resolve => new cset X
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 5 of 5 STABLE] tests: use bat script as sendmail program on Windows for test portability

2016-10-28 Thread FUJIWARA Katsunori
# HG changeset patch
# User FUJIWARA Katsunori 
# Date 1477678088 -32400
#  Sat Oct 29 03:08:08 2016 +0900
# Branch stable
# Node ID d9ddb5fcfe76494a324bcffb4bc4516dcc0378fb
# Parent  51b14d2127fbd214c5ec57f9c1ef17457c61f93d
tests: use bat script as sendmail program on Windows for test portability

On Windows platform, unless binding between *.sh suffix and sh.exe or
so, *.sh script can't be spawned by just name (or full path) of it.

In addition to it, mail.py of Mercurial requires that email.method
value itself can be found as an executable file on PATH.

Therefore, "sh /path/to/sendmail/script.sh" configuration doesn't work
in this case.

diff --git a/tests/test-patchbomb.t b/tests/test-patchbomb.t
--- a/tests/test-patchbomb.t
+++ b/tests/test-patchbomb.t
@@ -2730,6 +2730,18 @@ dest#branch URIs:
 
 Set up a fake sendmail program
 
+#if windows
+  $ cat > $TESTTMP/t2/pretendmail.bat < @echo off
+  > echo %*
+  > cat
+  > EOF
+
+  $ cat >> $HGRCPATH < [email]
+  > method = $TESTTMP\t2\pretendmail.bat
+  > EOF
+#else
   $ cat > pretendmail.sh << 'EOF'
   > #!/bin/sh
   > echo "$@"
@@ -2739,6 +2751,7 @@ Set up a fake sendmail program
 
   $ echo '[email]' >> $HGRCPATH
   $ echo "method=`pwd`/pretendmail.sh" >> $HGRCPATH
+#endif
 
 Test introduction configuration
 =
@@ -2833,7 +2846,7 @@ single rev
   (should be one of always, never, auto)
   
   sending [PATCH] test ...
-  sending mail: $TESTTMP/t2/pretendmail.sh -f test foo
+  sending mail: $TESTTMP/t2/pretendmail.* -f test foo (glob)
   -f test foo
   Content-Type: text/plain; charset="us-ascii"
   MIME-Version: 1.0
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 4 of 5 STABLE] mail: use popen4 instead of popen for portability

2016-10-28 Thread FUJIWARA Katsunori
# HG changeset patch
# User FUJIWARA Katsunori 
# Date 1477678088 -32400
#  Sat Oct 29 03:08:08 2016 +0900
# Branch stable
# Node ID 51b14d2127fbd214c5ec57f9c1ef17457c61f93d
# Parent  141cb12c0175d9e4fbdab1f69d99be24d50ce3f4
mail: use popen4 instead of popen for portability

On Windows platform, the process spawned by util.popen("w") doesn't
work as expected, if it writes anything into stdout of it. In such
case, spawned child process terminates with status code 68864 (at
least, simple .bat script does so).

Maybe, this is a variant of python issue below, which is handled in
popen() in windows.py of Mercurial.

http://bugs.python.org/issue1366

This patch shows stderr output of spawned process at first, to prevent
users from overlooking serious information after long stdout output.

This ui.warn() invocation causes flushing messages buffered by ui
before popen4(). Therefore, this patch also moves ui.note() output in
test-patchbomb.t.

This patch chooses util.popen4(), because other util.popen* family
doesn't provide the way to get exit code of spawned process.

BTW, other clients except for spawning pager process in patchbomb use
util.popen() only in "read" mode. They (spawning pager, too) should be
safe and portable enough, even though discarding stderr on Windows
might have to be fixed for safety.

diff --git a/mercurial/mail.py b/mercurial/mail.py
--- a/mercurial/mail.py
+++ b/mercurial/mail.py
@@ -160,9 +160,15 @@ def _sendmail(ui, sender, recipients, ms
 cmdline = '%s -f %s %s' % (program, util.email(sender),
' '.join(map(util.email, recipients)))
 ui.note(_('sending mail: %s\n') % cmdline)
-fp = util.popen(cmdline, 'w')
-fp.write(msg)
-ret = fp.close()
+p = util.popen4(cmdline)[3]
+outdata, errdata = p.communicate(msg)
+errdata = errdata.rstrip()
+if errdata:
+ui.warn(errdata + '\n')
+outdata = outdata.rstrip()
+if outdata:
+ui.write(outdata + '\n')
+ret = p.returncode
 if ret:
 raise error.Abort('%s %s' % (
 os.path.basename(program.split(None, 1)[0]),
diff --git a/tests/test-patchbomb.t b/tests/test-patchbomb.t
--- a/tests/test-patchbomb.t
+++ b/tests/test-patchbomb.t
@@ -2831,6 +2831,9 @@ single rev
   
   warning: invalid patchbomb.intro value "mpmwearaclownnose"
   (should be one of always, never, auto)
+  
+  sending [PATCH] test ...
+  sending mail: $TESTTMP/t2/pretendmail.sh -f test foo
   -f test foo
   Content-Type: text/plain; charset="us-ascii"
   MIME-Version: 1.0
@@ -2861,9 +2864,6 @@ single rev
   @@ -1,1 +1,2 @@
d
   +d
-  
-  sending [PATCH] test ...
-  sending mail: $TESTTMP/t2/pretendmail.sh -f test foo
 
 Test pull url header
 =
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 5 STABLE] tests: invoke printenv.py via sh -c for test portability

2016-10-28 Thread FUJIWARA Katsunori
# HG changeset patch
# User FUJIWARA Katsunori 
# Date 1477676685 -32400
#  Sat Oct 29 02:44:45 2016 +0900
# Branch stable
# Node ID 34a5f6c66bc5a13381a68d08f73d858916167836
# Parent  3afde791dce192f38d8a228ed8e49397e353837e
tests: invoke printenv.py via sh -c for test portability

On Windows platform, invoking printenv.py directly via hook is
problematic, because:

  - unless binding between *.py suffix and python runtime, application
selector dialog is displayed, and running test is blocked at each
printenv.py invocations

  - it isn't safe to assume binding between *.py suffix and python
runtime, because application binding is easily broken

For example, installing IDE (VisualStudio with Python Tools, or
so) often requires binding between source files and IDE itself.

This patch invokes printenv.py via sh -c for test portability. This is
a kind of follow up for d19787db6fe0, which eliminated explicit
"python" for printenv.py. There are already other 'sh -c "printenv.py"'
in *.t files, and this fix should be reasonable.

This changes were confirmed in cases below:

  - without any application binding for *.py suffix
  - with binding between *.py suffix and VisualStudio

This patch also replaces "echo + redirection" style with "heredoc"
style, because:

  - hook command line is parsed by cmd.exe as shell at first, and
  - single quotation can't quote arguments on cmd.exe, therefore,
  - "printenv.py foobar" should be quoted by double quotation, but
  - nested quoting (or tricky escaping) isn't readable

diff --git a/tests/test-bundle.t b/tests/test-bundle.t
--- a/tests/test-bundle.t
+++ b/tests/test-bundle.t
@@ -216,8 +216,10 @@ Make sure bundlerepo doesn't leak tempfi
 
 Pull ../full.hg into empty (with hook)
 
-  $ echo "[hooks]" >> .hg/hgrc
-  $ echo "changegroup = printenv.py changegroup" >> .hg/hgrc
+  $ cat >> .hg/hgrc < [hooks]
+  > changegroup = sh -c "printenv.py changegroup"
+  > EOF
 
 doesn't work (yet ?)
 
diff --git a/tests/test-hook.t b/tests/test-hook.t
--- a/tests/test-hook.t
+++ b/tests/test-hook.t
@@ -16,9 +16,9 @@ commit hooks can see env vars
   > precommit = sh -c  "HG_LOCAL= HG_NODE= HG_TAG= printenv.py precommit"
   > pretxncommit = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxncommit"
   > pretxncommit.tip = hg -q tip
-  > pre-identify = printenv.py pre-identify 1
-  > pre-cat = printenv.py pre-cat
-  > post-cat = printenv.py post-cat
+  > pre-identify = sh -c "printenv.py pre-identify 1"
+  > pre-cat = sh -c "printenv.py pre-cat"
+  > post-cat = sh -c "printenv.py post-cat"
   > pretxnopen = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnopen"
   > pretxnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnclose"
   > txnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py txnclose"
@@ -47,9 +47,9 @@ changegroup hooks can see env vars
 
   $ cat > .hg/hgrc < [hooks]
-  > prechangegroup = printenv.py prechangegroup
-  > changegroup = printenv.py changegroup
-  > incoming = printenv.py incoming
+  > prechangegroup = sh -c "printenv.py prechangegroup"
+  > changegroup = sh -c "printenv.py changegroup"
+  > incoming = sh -c "printenv.py incoming"
   > EOF
 
 pretxncommit and commit hooks can see both parents of merge
@@ -122,7 +122,7 @@ tag hooks can see env vars
 
   $ cd ../a
   $ cat >> .hg/hgrc < pretag = printenv.py pretag
+  > pretag = sh -c "printenv.py pretag"
   > tag = sh -c "HG_PARENT1= HG_PARENT2= printenv.py tag"
   > EOF
   $ hg tag -d '3 0' a
@@ -142,7 +142,9 @@ tag hooks can see env vars
 
 pretag hook can forbid tagging
 
-  $ echo "pretag.forbid = printenv.py pretag.forbid 1" >> .hg/hgrc
+  $ cat >> .hg/hgrc < pretag.forbid = sh -c "printenv.py pretag.forbid 1"
+  > EOF
   $ hg tag -d '4 0' fa
   pretag hook: HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 
HG_TAG=fa
   pretag.forbid hook: HG_LOCAL=0 
HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa
@@ -157,8 +159,10 @@ pretag hook can forbid tagging
 pretxncommit hook can see changeset, can roll back txn, changeset no
 more there after
 
-  $ echo "pretxncommit.forbid0 = hg tip -q" >> .hg/hgrc
-  $ echo "pretxncommit.forbid1 = printenv.py pretxncommit.forbid 1" >> .hg/hgrc
+  $ cat >> .hg/hgrc < pretxncommit.forbid0 = sh -c "hg tip -q"
+  > pretxncommit.forbid1 = sh -c "printenv.py pretxncommit.forbid 1"
+  > EOF
   $ echo z > z
   $ hg add z
   $ hg -q tip
@@ -196,7 +200,9 @@ more there after
 
 precommit hook can prevent commit
 
-  $ echo "precommit.forbid = printenv.py precommit.forbid 1" >> .hg/hgrc
+  $ cat >> .hg/hgrc < precommit.forbid = sh -c "printenv.py precommit.forbid 1"
+  > EOF
   $ hg commit -m 'fail' -d '4 0'
   precommit hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
   precommit.forbid hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
@@ -207,14 +213,18 @@ precommit hook can prevent commit
 
 preupdate hook can prevent update
 
-  $ echo "preupdate = printenv.py preupdate" >> .hg/hgrc
+  $ cat >> .hg/hgrc < preupdate = sh -c 

[PATCH 2 of 5 STABLE] tests: use "?" to glob both ":" and "; " in output for test portability

2016-10-28 Thread FUJIWARA Katsunori
# HG changeset patch
# User FUJIWARA Katsunori 
# Date 1477677894 -32400
#  Sat Oct 29 03:04:54 2016 +0900
# Branch stable
# Node ID fe612ab5eeff700b808a1d85013fa3472517a3d6
# Parent  34a5f6c66bc5a13381a68d08f73d858916167836
tests: use "?" to glob both ":" and ";" in output for test portability

If environment variable looks like PATH or so (e.g. any of components
joined by ":" contains "/"), ":" in it is replaced with ";" by MinGW
at spawning Windows native process, to follow path concatenation style
of Windows.

Therefore, "bundle:../full.hg" is converted into "bundle;..\full.hg"
on MinGW.

Difference between "/" and "\" is automatically ignored by "(glob)",
but difference between ":" and ";" should be globed explicitly.

diff --git a/tests/test-bundle.t b/tests/test-bundle.t
--- a/tests/test-bundle.t
+++ b/tests/test-bundle.t
@@ -232,7 +232,7 @@ hg -R bundle://../full.hg verify
   adding manifests
   adding file changes
   added 9 changesets with 7 changes to 4 files (+1 heads)
-  changegroup hook: HG_NODE=f9ee2f85a263049e9ae6d37a0e67e96194ffb735 
HG_NODE_LAST=aa35859c02ea8bd48da5da68cd2740ac71afcbaf HG_SOURCE=pull 
HG_TXNID=TXN:* HG_URL=bundle:../full.hg (glob)
+  changegroup hook: HG_NODE=f9ee2f85a263049e9ae6d37a0e67e96194ffb735 
HG_NODE_LAST=aa35859c02ea8bd48da5da68cd2740ac71afcbaf HG_SOURCE=pull 
HG_TXNID=TXN:* HG_URL=bundle?../full.hg (glob)
   (run 'hg heads' to see heads, 'hg merge' to merge)
 
 Rollback empty
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 3 of 5 STABLE] tests: add test-commit-interactive-curses.t "require tic" for test portability

2016-10-28 Thread FUJIWARA Katsunori
# HG changeset patch
# User FUJIWARA Katsunori 
# Date 1477678088 -32400
#  Sat Oct 29 03:08:08 2016 +0900
# Branch stable
# Node ID 141cb12c0175d9e4fbdab1f69d99be24d50ce3f4
# Parent  fe612ab5eeff700b808a1d85013fa3472517a3d6
tests: add test-commit-interactive-curses.t "require tic" for test portability

Standard library of Python on Windows doesn't have curses module.

diff --git a/tests/test-commit-interactive-curses.t 
b/tests/test-commit-interactive-curses.t
--- a/tests/test-commit-interactive-curses.t
+++ b/tests/test-commit-interactive-curses.t
@@ -1,3 +1,5 @@
+#require tic
+
 Set up a repo
 
   $ cp $HGRCPATH $HGRCPATH.pretest
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


RE: [PATCH STABLE] build: include a dummy $PATH in the custom environment used by build.py

2016-10-28 Thread Gábor STEFANIK
>


--
This message, including its attachments, is confidential. For more information 
please read NNG's email policy here:
http://www.nng.com/emailpolicy/
By responding to this email you accept the email policy.


-Original Message-
> From: Mercurial-devel [mailto:mercurial-devel-boun...@mercurial-scm.org]
> On Behalf Of Gábor STEFANIK
> Sent: Friday, October 28, 2016 7:13 PM
> To: Pierre-Yves David ; mercurial-
> de...@mercurial-scm.org
> Subject: RE: [PATCH STABLE] build: include a dummy $PATH in the custom
> environment used by build.py
>
> >
>
>
> --
> This message, including its attachments, is confidential. For more information
> please read NNG's email policy here:
> http://www.nng.com/emailpolicy/
> By responding to this email you accept the email policy.
>
>
> -Original Message-
> > From: Pierre-Yves David [mailto:pierre-yves.da...@ens-lyon.org]
> > Sent: Friday, October 28, 2016 7:03 PM
> > To: Gábor STEFANIK ; mercurial-
> > de...@mercurial-scm.org
> > Subject: Re: [PATCH STABLE] build: include a dummy $PATH in the custom
> > environment used by build.py
> >
> >
> >
> > On 10/28/2016 05:55 PM, Gábor Stefanik wrote:
> > > # HG changeset patch
> > > # User Gábor Stefanik  # Date 1477669468 -
> 7200
> > > #  Fri Oct 28 17:44:28 2016 +0200
> > > # Branch stable
> > > # Node ID 3cda0b069802af8b4dbdf9f5598965a522a566b3
> > > # Parent  3afde791dce192f38d8a228ed8e49397e353837e
> > > build: include a dummy $PATH in the custom environment used by
> > > build.py
> > >
> > > This is required for building with pypiwin32, the pip-installable
> > > replacement for pywin32.
> >
> > What does the '.' value means here?
>
> It is supposed to mean $(pwd). Maybe setting to an empty string would be
> safer?

The problem is that pypiwin32 does os.environ['PATH'] += ... in a .pth file 
(loaded by site.py),
which fails if 'PATH' is not in os.environ.

The original pywin32 doesn't have this issue, but it can only be obtained by 
downloading
a Windows .exe installer from SourceForge, a site known to have previously 
injected
malware into .exe installers it hosts.

>
> >
> > >
> > > diff -r 3afde791dce1 -r 3cda0b069802 setup.py
> > > --- a/setup.pyThu Oct 27 20:06:33 2016 +0200
> > > +++ b/setup.pyFri Oct 28 17:44:28 2016 +0200
> > > @@ -167,7 +167,8 @@
> > >  # to not use any hgrc files and do no localization.
> > >  env = {'HGMODULEPOLICY': 'py',
> > > 'HGRCPATH': '',
> > > -   'LANGUAGE': 'C'}
> > > +   'LANGUAGE': 'C',
> > > +   'PATH': '.'}
> > >  if 'LD_LIBRARY_PATH' in os.environ:
> > >  env['LD_LIBRARY_PATH'] = os.environ['LD_LIBRARY_PATH']  if
> > > 'SystemRoot' in os.environ:
> > > ___
> > > Mercurial-devel mailing list
> > > Mercurial-devel@mercurial-scm.org
> > > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
> > >
> >
> > --
> > Pierre-Yves David
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH STABLE] build: include a dummy $PATH in the custom environment used by build.py

2016-10-28 Thread Pierre-Yves David



On 10/28/2016 05:55 PM, Gábor Stefanik wrote:

# HG changeset patch
# User Gábor Stefanik 
# Date 1477669468 -7200
#  Fri Oct 28 17:44:28 2016 +0200
# Branch stable
# Node ID 3cda0b069802af8b4dbdf9f5598965a522a566b3
# Parent  3afde791dce192f38d8a228ed8e49397e353837e
build: include a dummy $PATH in the custom environment used by build.py

This is required for building with pypiwin32, the pip-installable replacement
for pywin32.


What does the '.' value means here?



diff -r 3afde791dce1 -r 3cda0b069802 setup.py
--- a/setup.py  Thu Oct 27 20:06:33 2016 +0200
+++ b/setup.py  Fri Oct 28 17:44:28 2016 +0200
@@ -167,7 +167,8 @@
 # to not use any hgrc files and do no localization.
 env = {'HGMODULEPOLICY': 'py',
'HGRCPATH': '',
-   'LANGUAGE': 'C'}
+   'LANGUAGE': 'C',
+   'PATH': '.'}
 if 'LD_LIBRARY_PATH' in os.environ:
 env['LD_LIBRARY_PATH'] = os.environ['LD_LIBRARY_PATH']
 if 'SystemRoot' in os.environ:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel



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


RE: [PATCH STABLE] build: include a dummy $PATH in the custom environment used by build.py

2016-10-28 Thread Gábor STEFANIK
>


--
This message, including its attachments, is confidential. For more information 
please read NNG's email policy here:
http://www.nng.com/emailpolicy/
By responding to this email you accept the email policy.


-Original Message-
> From: Mercurial-devel [mailto:mercurial-devel-boun...@mercurial-scm.org]
> On Behalf Of Gábor Stefanik
> Sent: Friday, October 28, 2016 5:55 PM
> To: mercurial-devel@mercurial-scm.org
> Subject: [PATCH STABLE] build: include a dummy $PATH in the custom
> environment used by build.py
>
> # HG changeset patch
> # User Gábor Stefanik  # Date 1477669468 -7200
> #  Fri Oct 28 17:44:28 2016 +0200
> # Branch stable
> # Node ID 3cda0b069802af8b4dbdf9f5598965a522a566b3
> # Parent  3afde791dce192f38d8a228ed8e49397e353837e
> build: include a dummy $PATH in the custom environment used by build.py
>
> This is required for building with pypiwin32, the pip-installable replacement
> for pywin32.

Just to clarify, without this, merely installing pypiwin32 completely breaks 
setup.py,
even for targets that don't try to use pywin32 for anything.

>
> diff -r 3afde791dce1 -r 3cda0b069802 setup.py
> --- a/setup.pyThu Oct 27 20:06:33 2016 +0200
> +++ b/setup.pyFri Oct 28 17:44:28 2016 +0200
> @@ -167,7 +167,8 @@
>  # to not use any hgrc files and do no localization.
>  env = {'HGMODULEPOLICY': 'py',
> 'HGRCPATH': '',
> -   'LANGUAGE': 'C'}
> +   'LANGUAGE': 'C',
> +   'PATH': '.'}
>  if 'LD_LIBRARY_PATH' in os.environ:
>  env['LD_LIBRARY_PATH'] = os.environ['LD_LIBRARY_PATH']  if
> 'SystemRoot' in os.environ:
> ___
> 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 v5] copy: distinguish "file exists" cases and add a hint (BC)

2016-10-28 Thread Kevin Bullock
> On Oct 28, 2016, at 03:58, Pierre-Yves David  
> wrote:
> 
> On 10/26/2016 10:10 PM, Kevin Bullock wrote:
>>> On Oct 26, 2016, at 15:05, Augie Fackler  wrote:
>>> 
 On Oct 26, 2016, at 15:03, timeless  wrote:
 
 Augie Fackler wrote:
> +hint = _('(hg rename %s to replace the file by '
> + 'recording a rename)\n') % flags
> +hint = _('(hg copy %s to replace the file by '
> + 'recording a copy)\n') % flags
> +hint = _('(hg rename --after to record the 
> rename)\n')
> +hint = _('(hg copy --after to record the 
> copy)\n')
 
 I know it's too late, but do we want to include backticks around the
 part that's a command?
 
 Otherwise it's hard for people (and translators, and people reading
 translations) to figure out what to do...
>>> 
>>> If that's something we normally do, can you prep a patch to mail early in 
>>> the 4.1 cycle? (This is just a hint, so we can change the hint text safely.)
>> 
>> Changes to hint text should be fine during a freeze. No need to wait until 
>> November.
> 
> I can't remember what the exact policy have been in the past, but doesn't 
> this change the translated string impacting the translator work during the 
> freeze window ?

I'm not totally clear on what our approach to translations during a freeze is 
either. I'm going by the freeze rules on the wiki, and the fact that 
translation always happens on stable anyway, both of which lead me to believe 
it should be okay?

Last time this was discussed seems to be: 


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 2 of 2 website] downloads: link to new main repo

2016-10-28 Thread Pierre-Yves David



On 10/28/2016 06:02 PM, Kevin Bullock wrote:

On Oct 27, 2016, at 17:49, Sean Farley  wrote:

Pierre-Yves David  writes:


On 10/27/2016 10:26 PM, Sean Farley wrote:

Kevin Bullock  writes:


# HG changeset patch
# User Kevin Bullock 
# Date 1475271469 18000
#  Fri Sep 30 16:37:49 2016 -0500
# Node ID 9f3fa665049191b36c950d4c674aa19208d1532b
# Parent  2323b843b7bf2260d8cfa6e841f1f059855464c2
downloads: link to new main repo

diff --git a/templates/downloads/index.html b/templates/downloads/index.html
--- a/templates/downloads/index.html
+++ b/templates/downloads/index.html
@@ -49,8 +49,8 @@
  Main
  The main development repository of the Mercurial maintainer
  https://www.mercurial-scm.org/wiki/mpm;>Matt Mackall
-  can be found at https://selenic.com/hg;>
-  https://selenic.com/hg.
+  can be found at https://www.mercurial-scm.org/repo/hg;>
+  https://www.mercurial-scm.org/repo/hg.


I've queued both these patches, thanks!


I pulled from https://bitbucket.org/seanfarley/hgwebsite/ and I only see
the second one (based on an obsolete changeset), am I using the right URL ?


I haven't pushed yet, sorry.


I've taken both patch from the email.


Ok, what should I do now?


The canonical repo should be , 
yes? Pierre-Yves, I assume that's where you pushed the patches?


Yep, I pushed them there. We figured out thing on IRC with Sean and we 
forgot to mention it he. Sorry about that.


Cheers,

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


Re: [PATCH python-hglib] add init() to hgclient to allow progress to be reported

2016-10-28 Thread Yuya Nishihara
On Fri, 28 Oct 2016 11:47:09 +0100, Barry A. Scott wrote:
> # HG changeset patch
> # User Barry A. Scott 
> # Date 1477651557 -3600
> #  Fri Oct 28 11:45:57 2016 +0100
> # Node ID ab7eec553872e3e5bc58c73b09a61f73f6470690
> # Parent  6f15cb7cc9cb4427f35c60080f85dbf4ca5abd10
> add init() to hgclient to allow progress to be reported
> 
> The init() command is required as a member of hgclient
> so that progress, output and errors from the init() command
> can be sent to cbout and cberr call backs.

Looks good to me. Marked as pre-reviewd, thanks.

Also, can you add some tests as a follow-up?
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH python-hglib v3] Allow hglib user to get call backs for prompts, output and errors

2016-10-28 Thread Yuya Nishihara
On Fri, 28 Oct 2016 11:35:27 +0100, Barry A. Scott wrote:
> # HG changeset patch
> # User Barry A. Scott 
> # Date 1477650800 -3600
> #  Fri Oct 28 11:33:20 2016 +0100
> # Node ID dd7ce6a2c32d179eb2881d08e13d11631bf341fa
> # Parent  6f15cb7cc9cb4427f35c60080f85dbf4ca5abd10
> Allow hglib user to get call backs for prompts, output and errors.
> 
> setcbout(cbout), setcberr(cberr) and setcbprompt(cbprompt) are used to
> set the call back function used by the hgclient class. cb stands for
> call back.
> 
> cbout is a function that will be called with the stdout data of the
> command as it runs. cbout is called with output as it is made available,
> which can be as partial lines or multiple lines.
> 
> cberr is a function that will be called with the stderr data of the
> command as it runs. cberr is called with output as it is made available,
> which can be as partial lines or multiple lines.
> 
> Command that make remote connects can prompt for username and password
> for HTTP/HTTPS connections.
> 
> cbprompt is called when hgclient need a response to a prompt from the
> server. It receives the max number of bytes to return and the contents
> of stdout received so far. The last text sent to either cbout or cberr
> will contain the prompt text itself.

I'm not a big fan of these APIs, but they look okay and solve the real
problem, so seem good. Marked as pre-reviewed, thanks.

Can you add some tests as a follow-up?
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH STABLE V2] tests: run "cwd was removed" test only if cwd can actually be removed

2016-10-28 Thread Yuya Nishihara
On Fri, 28 Oct 2016 10:23:57 +0200, Pierre-Yves David wrote:
> > +@check("rmcwd", "can remove current working directory")
> > +def has_rmcwd():
> > +ocwd = os.getcwd()
> > +temp = tempfile.mkdtemp(dir='.', prefix=tempprefix)
> > +try:
> > +os.chdir(temp)
> > +# On Linux, 'rmdir .' isn't allowed, but the other names are okay.
> > +# On Solaris and Windows, the cwd can't be removed by any names.
> > +os.rmdir(os.getcwd())
> > +return True
> > +except OSError:
> > +return False
> 
> Maybe we should check the errno here too? (as a followup)

I copied it from the other filesystem checks. hghave.py seems not that strict
about handling of OSError.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH evolve v2] tests: use curl instead of wget

2016-10-28 Thread Matt Harbison

> On Oct 28, 2016, at 4:53 AM, Pierre-Yves David 
>  wrote:
> 
> 
> 
>> On 10/25/2016 02:23 PM, Simon Farnsworth wrote:
>> # HG changeset patch
>> # User Simon Farnsworth 
>> # Date 1477397752 25200
>> #  Tue Oct 25 05:15:52 2016 -0700
>> # Branch stable
>> # Node ID f65f9acac6c69e6f2eb90b2ed9b51d818a046f67
>> # Parent  970a4c13ebc320a034bc0aff21e0ef0a84157a92
>> tests: use curl instead of wget
> 
> Matt (Harbison) can you confirm you are okay with this change before I take 
> it?

If it's possible to dynamically switch between tools, that's obviously better.  
But I don't have a problem accepting this for short term convenience.

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


[PATCH python-hglib] add init() to hgclient to allow progress to be reported

2016-10-28 Thread Barry A. Scott
# HG changeset patch
# User Barry A. Scott 
# Date 1477651557 -3600
#  Fri Oct 28 11:45:57 2016 +0100
# Node ID ab7eec553872e3e5bc58c73b09a61f73f6470690
# Parent  6f15cb7cc9cb4427f35c60080f85dbf4ca5abd10
add init() to hgclient to allow progress to be reported

The init() command is required as a member of hgclient
so that progress, output and errors from the init() command
can be sent to cbout and cberr call backs.

diff -r 6f15cb7cc9cb -r ab7eec553872 hglib/client.py
--- a/hglib/client.py   Mon Jul 18 23:40:45 2016 -0500
+++ b/hglib/client.py   Fri Oct 28 11:45:57 2016 +0100
@@ -539,6 +539,11 @@
   u=updaterev, r=revrange)
 self.rawcommand(args)
 
+def init(self, dest, ssh=None, remotecmd=None, insecure=False):
+args = util.cmdbuilder('init', dest, e=ssh, remotecmd=remotecmd,
+   insecure=insecure)
+self.rawcommand(args)
+
 def commit(self, message=None, logfile=None, addremove=False,
closebranch=False, date=None, user=None, include=None,
exclude=None, amend=False):
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH python-hglib v3] Allow hglib user to get call backs for prompts, output and errors

2016-10-28 Thread Barry A. Scott
# HG changeset patch
# User Barry A. Scott 
# Date 1477650800 -3600
#  Fri Oct 28 11:33:20 2016 +0100
# Node ID dd7ce6a2c32d179eb2881d08e13d11631bf341fa
# Parent  6f15cb7cc9cb4427f35c60080f85dbf4ca5abd10
Allow hglib user to get call backs for prompts, output and errors.

setcbout(cbout), setcberr(cberr) and setcbprompt(cbprompt) are used to
set the call back function used by the hgclient class. cb stands for
call back.

cbout is a function that will be called with the stdout data of the
command as it runs. cbout is called with output as it is made available,
which can be as partial lines or multiple lines.

cberr is a function that will be called with the stderr data of the
command as it runs. cberr is called with output as it is made available,
which can be as partial lines or multiple lines.

Command that make remote connects can prompt for username and password
for HTTP/HTTPS connections.

cbprompt is called when hgclient need a response to a prompt from the
server. It receives the max number of bytes to return and the contents
of stdout received so far. The last text sent to either cbout or cberr
will contain the prompt text itself.

diff -r 6f15cb7cc9cb -r dd7ce6a2c32d hglib/client.py
--- a/hglib/client.py   Mon Jul 18 23:40:45 2016 -0500
+++ b/hglib/client.py   Fri Oct 28 11:33:20 2016 +0100
@@ -59,9 +59,40 @@
 # include the hidden changesets if True
 self.hidden = None
 
+self._cbout = None
+self._cberr = None
+self._cbprompt = None
+
 if connect:
 self.open()
 
+def setcbout(self, cbout):
+"""
+cbout is a function that will be called with the stdout data of
+ the command as it runs. Call with None to stop getting call backs.
+"""
+self._cbout = cbout
+
+def setcberr(self, cberr):
+"""
+cberr is a function that will be called with the stderr data of
+ the command as it runs.Call with None to stop getting call backs.
+"""
+self._cberr = cberr
+
+def setcbprompt(self, cbprompt):
+"""
+cbprompt is used to reply to prompts by the server
+ It receives the max number of bytes to return and the
+ contents of stdout received so far.
+
+Call with None to stop getting call backs.
+
+cbprompt is never called from merge() or import_()
+which already handle the prompt.
+"""
+self._cbprompt = cbprompt
+
 def __enter__(self):
 if self.server is None:
 self.open()
@@ -164,9 +195,25 @@
 It receives the max number of bytes to return
 """
 out, err = BytesIO(), BytesIO()
-outchannels = {b('o') : out.write, b('e') : err.write}
+outchannels = {}
+if self._cbout is None:
+outchannels[b('o')] = out.write
+else:
+def out_handler(data):
+out.write(data)
+self._cbout(data)
+outchannels[b('o')] = out_handler
+if self._cberr is None:
+outchannels[b('e')] = err.write
+else:
+def err_handler(data):
+err.write(data)
+self._cberr(data)
+outchannels[b('e')] = err_handler
 
 inchannels = {}
+if prompt is None:
+prompt = self._cbprompt
 if prompt is not None:
 def func(size):
 reply = prompt(size, out.getvalue())
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 3 of 4 STABLE] manifest: make manifestctx store the repo

2016-10-28 Thread Pierre-Yves David



On 10/27/2016 07:55 PM, Durham Goode wrote:



On 10/27/16 5:22 AM, Yuya Nishihara wrote:

On Wed, 26 Oct 2016 09:42:09 -0700, Durham Goode wrote:

On 10/26/16 5:54 AM, Yuya Nishihara wrote:

On Tue, 25 Oct 2016 12:46:58 -0700, Durham Goode wrote:

On 10/22/16 1:59 AM, Yuya Nishihara wrote:

On Tue, 18 Oct 2016 17:50:16 -0700, Durham Goode wrote:

# HG changeset patch
# User Durham Goode 
# Date 1476837866 25200
#  Tue Oct 18 17:44:26 2016 -0700
# Branch stable
# Node ID 3efece5c59853908d65de53635488361dbf20c49
# Parent  ed607426a3ff4deda8c7f2de8b86d5b6ca976d67
manifest: make manifestctx store the repo

The old manifestctx stored a reference to the revlog. If the
inmemory revlog
became invalid, the ctx now held an old copy and would be
incorrect. To fix
this, we need the ctx to go through the manifestlog for each access.

This is the same pattern that changectx already uses (it stores
the repo, and
accesses commit data through self._repo.changelog).

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -1276,7 +1276,7 @@ class manifestlog(object):
if self._treeinmem:
m = treemanifestctx(self._revlog, '', node)
else:
-m = manifestctx(self._revlog, node)
+m = manifestctx(self._repo, node)
if node != revlog.nullid:
self._mancache[node] = m

This will create a reference cycle, but I don't know if the
situation gets
better or worse after this patch.

 repo -> manifestlog -> _mancache -> manifestctx -> repo

Is _mancache valid after the manifestlog is recreated?

_mancache is not really valid after manifestlog is recreated, since it
may contain manifest entries that no longer exist in the file. Even if
it didn't contain bad entries, the manifestctx itself needs up-to-date
access to the manifest revlog, which is only available through the
repo
object (since the repo object's property is what handles manifest
revlog
cache checking).

Perhaps I miss the point. Do we have stale copies of manifestlog and
manifestctx
somewhere? My understanding is we've moved the @storecache to
manifestlog() at
3c8811efdddc, so manifestlog, _revlog (and _mancache) should be
accessible only
when they are valid, and manifestlog doesn't live longer than
repo.manifest().

Ah, yes manifestctx's may be held for longer than the manifestlog lives,
by code that is out of our control.  I'm not aware of specific cases
where this is happening, but it could.

Got it, thanks.

It seems manifestctx has slightly different guarantee about its
lifetime from
changectx. changectx is effectively a snapshot when repo[changeid] is
called
(more precisely, when propertycached function is called.)

changectx seems the same to me.  From looking at the changectx code, it
looks like it doesn't actually load any of the commit data until the
first property is accessed (i.e. changectx._changectx looks in the
changelog for data).  So if someone held on to the ctx for a bit, and
accessed ctx._changectx after the changelog had been mutated, it's
important that it goes through repo.changelog so it gets the most
up-to-date version.


The changectx seems to be using the revision index to access data. So 
I'm not sure in what kind of scenario would make a reloading of the 
mutated changelog useful. Am I missing something ? Can you elaborate on 
these case?



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


Re: Nested Subrepos non-recursive/deferred cloning

2016-10-28 Thread Pierre-Yves David



On 10/23/2016 08:26 PM, Ken Frederickson wrote:

Hello,

When using subrepos, I frequently get in a situation where nested
subrepos result in multiple copies of the same repo. This can cause
several headaches, like a hit on sync time, confusion which copy of the
redundant repo I'm co-developing, etc. Additionally, it's troubling that
cloning of the parent repo fails if the clone of the subrepo fails,
which could easily happen if the URL of the subrepo has been altered
(i.e. server migration).

My solution is to write a custom extension that largely mimics the
functionality of subrepos, but does not automatically recursively clone
subrepos. Instead, I would make a command that I could execute at each
repo level that would pull one or all of its subrepos. My question is:
have some of these issues already been considered or partially addressed
with more recent subrepo work? Should I contribute to subrepo or should
I stick with an independent extension?


We recently gained the ability to have both version of binary flag (eg 
`hg up --check` and `hg up --no-check`. (This is very new and not 
documented yet). We could use this with the canonical subrepository 
option and clone to introduce a `hg clone --no-subrepository` to would 
skip the subrepo clone. This could be extended to other operation


What do you think ?


I understand the recommended way
 of avoiding redundant
copies of repos is to use a super repo ("shell repo"). Unfortunately,
this comes with a number of undesirable side effects. It doesn't allow
my company's strict policy that every check-in pass a smoke test. If a
repo does not maintain its own subrepos but instead relies on a shell
repo, the repo can't be built and smoked in an atomic check-in
operation. It requires a second commit to shell repo. The other side
effect is I necessarily need to create a companion shell repo for
everything I want my CI server to test. Then there are workflow issues
if the repo is a subrepo of an app shell: somehow I need to commit the
repo, the app shell, and the dedicated companion shell in an atomic way.

I've tried the Guest Repo and Repoman extensions without success. Is a
new run at a subrepo alternative of interest to others?


Can you elaborate on the issue you encountered with these solutions

Cheers,

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


Re: [PATCH evolve v2] tests: use curl instead of wget

2016-10-28 Thread Pierre-Yves David



On 10/25/2016 02:23 PM, Simon Farnsworth wrote:

# HG changeset patch
# User Simon Farnsworth 
# Date 1477397752 25200
#  Tue Oct 25 05:15:52 2016 -0700
# Branch stable
# Node ID f65f9acac6c69e6f2eb90b2ed9b51d818a046f67
# Parent  970a4c13ebc320a034bc0aff21e0ef0a84157a92
tests: use curl instead of wget


Matt (Harbison) can you confirm you are okay with this change before I 
take it?


Cheers,

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


Re: [PATCH evolve] tests: use curl instead of wget

2016-10-28 Thread Pierre-Yves David

On 10/25/2016 10:30 AM, Simon Farnsworth wrote:

On 25/10/2016 02:34, Matt Harbison wrote:

On Mon, 24 Oct 2016 09:37:27 -0400, Simon Farnsworth 
wrote:
[…]

Would you like me to do a v2 of the patch summarizing this discussion
and linking to that page in the commit message?


Since I doubt many (any?) people run the tests on Windows, I don't have
a problem with switching back, if how to install curl is documented on
the page describing how to run tests on Windows.  I forget if I made
similar changes in core Mercurial.


This is the only test suite I run on macOS that uses wget - I run most
of the core test suite, so I'd notice if it needed wget.


Core have some special logic to use the one tool it can find.
Eg: https://www.mercurial-scm.org/repo/hg/rev/e278fc8bb0c3

As Jun suggested, we should probably get a small tool available to test 
tool.


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


Re: [PATCH stable] largefiles: handle that a found standin file doesn't exist when removing it

2016-10-28 Thread Pierre-Yves David



On 10/27/2016 08:06 PM, Mads Kiilerich wrote:

# HG changeset patch
# User Mads Kiilerich 
# Date 1477591593 -7200
#  Thu Oct 27 20:06:33 2016 +0200
# Branch stable
# Node ID 23f53561a8b6dcfbb35020df4d113fe34fec4c0e
# Parent  69ffbbe73dd03df0d1a00bdb2bc083fdb73ede09
largefiles: handle that a found standin file doesn't exist when removing it


Seems sensible, I've pushed it. Thanks.

Cheers,

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


Re: [PATCH stable] tests: work around instability that caused test from 4999c12c526b to fail

2016-10-28 Thread Pierre-Yves David



On 10/18/2016 03:32 PM, Pierre-Yves David wrote:



On 10/18/2016 03:18 PM, Mads Kiilerich wrote:

On 10/18/2016 02:30 PM, Pierre-Yves David wrote:



On 10/18/2016 01:33 AM, Mads Kiilerich wrote:

# HG changeset patch
# User Mads Kiilerich 
# Date 1476746894 -7200
#  Tue Oct 18 01:28:14 2016 +0200
# Branch stable
# Node ID 548f82b480d086c7a551b025fb980cd70187c880
# Parent  328545c7d8a1044330b8a5bfbdd9c2ff08625d6a
tests: work around instability that caused test from 4999c12c526b to
fail


I'm not too sure of what is going on here, Can you elaborate?


I'm also not sure what is going on. I suddenly saw the new test I added
started to fail. Not in the actual test but in the setup code.
Apparently unrelated to other recent changes - the new test just
happened to expose it. Thus, I suggest this workaround for now.


I would be more comfortable if we had a better idea of what is going one
here. Can you have a deeper look?


Any news on this?

Cheers,

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


Re: [PATCH 3 of 3 STABLE V2] changectx: do not include hidden revisions on short node lookup (issue4964)

2016-10-28 Thread Pierre-Yves David



On 10/26/2016 03:17 PM, Yuya Nishihara wrote:

On Tue, 25 Oct 2016 23:17:14 +0900, Yuya Nishihara wrote:

# HG changeset patch
# User Yuya Nishihara 
# Date 1477199774 -32400
#  Sun Oct 23 14:16:14 2016 +0900
# Branch stable
# Node ID 242b7a856495179795ee5662f298029c4b492563
# Parent  ecbce2fe4dea116c925a2fecd1b7b50df0a62589
changectx: do not include hidden revisions on short node lookup (issue4964)

It was changed at dc25ed84bee8, but which seems wrong since we filtered out
hidden nodes by _partialmatch() before that change. This patch makes
changectx() be consistent with the filtered changelog, and detect a hidden
short node only if it has no unique match in the filtered changelog.

Though we've made shortest(node) use unfiltered changelog, I think this is
a separate issue worth fixing.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -481,11 +481,16 @@ class changectx(basectx):
 except error.RepoLookupError:
 pass

-self._node = repo.unfiltered().changelog._partialmatch(changeid)
+self._node = repo.changelog._partialmatch(changeid)
 if self._node is not None:
 self._rev = repo.changelog.rev(self._node)
 return

+# lookup hidden node to provide a better error indication
+n = repo.unfiltered().changelog._partialmatch(changeid)
+if n is not None:
+repo.changelog.rev(n)  # must raise FilteredLookupError


Please feel free to drop this, the last patch, if the performance is important.


The behavior update seems good, however, you are mentionning performance 
impact but it is unclear of the extend of it. Can you mention any number?



This problem will be invisible since we're making shortest() use unfiltered
repo. We can fix it later when _partialmatch() gets fast enough.


Cheers,

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


Re: [PATCH STABLE V2] tests: run "cwd was removed" test only if cwd can actually be removed

2016-10-28 Thread Pierre-Yves David



On 10/27/2016 02:24 PM, Yuya Nishihara wrote:

# HG changeset patch
# User Yuya Nishihara 
# Date 1477489806 -32400
#  Wed Oct 26 22:50:06 2016 +0900
# Branch stable
# Node ID e405867f4c8a3f77d81ac44aeb75b7b739222c64
# Parent  b9f7b0c10027764cee77f9c6d61877fcffea837f
tests: run "cwd was removed" test only if cwd can actually be removed


I've pushed that one. Thanks.



On some platforms, cwd can't be removed. In which case, util.unlinkpath()
continues with no error since the failure of directory removal isn't critical.
So it doesn't make sense to run the test added by 90a6c18a7c1d on those
platforms. OTOH, we need to run the test in test-rebase-scenario-global.t
since the repository is referenced after that.

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -346,6 +346,21 @@ def has_hardlink():
 finally:
 os.unlink(fn)

+@check("rmcwd", "can remove current working directory")
+def has_rmcwd():
+ocwd = os.getcwd()
+temp = tempfile.mkdtemp(dir='.', prefix=tempprefix)
+try:
+os.chdir(temp)
+# On Linux, 'rmdir .' isn't allowed, but the other names are okay.
+# On Solaris and Windows, the cwd can't be removed by any names.
+os.rmdir(os.getcwd())
+return True
+except OSError:
+return False


Maybe we should check the errno here too? (as a followup)

Cheers,

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