D5088: hghave: add pyXY features for Python version numbers

2018-10-15 Thread indygreg (Gregory Szorc)
indygreg added a comment.


  In https://phab.mercurial-scm.org/D5088#76415, @durin42 wrote:
  
  > Ah, so I could do (no-py27 no-py35 !) I suppose. Doesn't help with the 
other half, but it's still only three lines...
  
  
  `(no-py27 no-py35 !)` would be "<2.7 & < 3.5", which would only be true for 
<=2.6. You'd want `no-py35` to say "Python 2.7 only" for example.
  
  > I'm not opposed to the patch, but I'm a little wary of it - so far we only 
have one use case and I already worked around that with an (re) line instead.
  
  Explicit annotation of expected differences in behavior is better than e.g. a 
`(re)`. I'm willing to be that `(re)` survives long after we drop support for 
Python 3.6 in several years...

REPOSITORY
  rHG Mercurial

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

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


[PATCH 2 of 2 V5] rust: rustfmt config for hg-direct-ffi

2018-10-15 Thread Georges Racinet
# HG changeset patch
# User Georges Racinet on ishtar.racinet.fr 
# Date 1539594972 -7200
#  Mon Oct 15 11:16:12 2018 +0200
# Node ID 58a939a95d72e90a78f795609fe59a1adef88ddf
# Parent  a7cbd02e936e6724068219ee4c1c50dd4da2b22c
# EXP-Topic rustancestors-contains
rust: rustfmt config for hg-direct-ffi

For now, we're duplicating it, but it would be probably a good idea
to use a single one for the whole workspace (would have implications on the
other crates as well)

diff -r a7cbd02e936e -r 58a939a95d72 rust/hg-direct-ffi/rustfmt.toml
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ b/rust/hg-direct-ffi/rustfmt.toml   Mon Oct 15 11:16:12 2018 +0200
@@ -0,0 +1,3 @@
+max_width = 79
+wrap_comments = true
+error_on_line_overflow = true
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 2 V5] rust: rustlazyancestors.__contains__

2018-10-15 Thread Georges Racinet
# HG changeset patch
# User Georges Racinet 
# Date 1539018701 -7200
#  Mon Oct 08 19:11:41 2018 +0200
# Node ID a7cbd02e936e6724068219ee4c1c50dd4da2b22c
# Parent  9cadb0f5f2279a60a79b1d0e50eccd60638495c0
# EXP-Topic rustancestors-contains
rust: rustlazyancestors.__contains__

This changeset provides a Rust implementation of
the iteration performed by lazyancestor.__contains__

It has the advantage over the Python iteration to use
the 'seen' set encapsuled into the dedicated iterator (self._containsiter),
rather than storing emitted items in another set (self._containsseen),
and hence should reduce the memory footprint.

Also, there's no need to convert intermediate emitted revisions back into
Python integers.

At this point, it would be tempting to implement the whole lazyancestor object
in Rust, but that would lead to more C wrapping code (two objects) for
little expected benefits.

diff -r 9cadb0f5f227 -r a7cbd02e936e mercurial/ancestor.py
--- a/mercurial/ancestor.py Thu Sep 27 16:55:44 2018 +0200
+++ b/mercurial/ancestor.py Mon Oct 08 19:11:41 2018 +0200
@@ -383,7 +383,7 @@
 self._containsiter = None
 return False
 
-class rustlazyancestors(lazyancestors):
+class rustlazyancestors(object):
 
 def __init__(self, index, revs, stoprev=0, inclusive=False):
 self._index = index
@@ -395,12 +395,26 @@
 # constructor (from C code) doesn't understand anything else yet
 self._initrevs = initrevs = list(revs)
 
-self._containsseen = set()
 self._containsiter = parsers.rustlazyancestors(
 index, initrevs, stoprev, inclusive)
 
+def __nonzero__(self):
+"""False if the set is empty, True otherwise.
+
+It's better to duplicate this essentially trivial method than
+to subclass lazyancestors
+"""
+try:
+next(iter(self))
+return True
+except StopIteration:
+return False
+
 def __iter__(self):
 return parsers.rustlazyancestors(self._index,
  self._initrevs,
  self._stoprev,
  self._inclusive)
+
+def __contains__(self, target):
+return target in self._containsiter
diff -r 9cadb0f5f227 -r a7cbd02e936e mercurial/cext/revlog.c
--- a/mercurial/cext/revlog.c   Thu Sep 27 16:55:44 2018 +0200
+++ b/mercurial/cext/revlog.c   Mon Oct 08 19:11:41 2018 +0200
@@ -2316,6 +2316,7 @@
int inclusive);
 void rustlazyancestors_drop(rustlazyancestorsObject *self);
 int rustlazyancestors_next(rustlazyancestorsObject *self);
+int rustlazyancestors_contains(rustlazyancestorsObject *self, long rev);
 
 /* CPython instance methods */
 static int rustla_init(rustlazyancestorsObject *self,
@@ -2395,6 +2396,24 @@
return PyInt_FromLong(res);
 }
 
+static int rustla_contains(rustlazyancestorsObject *self, PyObject *rev) {
+   if (!(PyInt_Check(rev))) {
+   return 0;
+   }
+   return rustlazyancestors_contains(self->iter, PyInt_AS_LONG(rev));
+}
+
+static PySequenceMethods rustla_sequence_methods = {
+   0,   /* sq_length */
+   0,   /* sq_concat */
+   0,   /* sq_repeat */
+   0,   /* sq_item */
+   0,   /* sq_slice */
+   0,   /* sq_ass_item */
+   0,   /* sq_ass_slice */
+   (objobjproc)rustla_contains, /* sq_contains */
+};
+
 static PyTypeObject rustlazyancestorsType = {
PyVarObject_HEAD_INIT(NULL, 0) /* header */
"parsers.rustlazyancestors",   /* tp_name */
@@ -2407,7 +2426,7 @@
0, /* tp_compare */
0, /* tp_repr */
0, /* tp_as_number */
-   0, /* tp_as_sequence */
+   &rustla_sequence_methods,  /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
diff -r 9cadb0f5f227 -r a7cbd02e936e rust/hg-core/src/ancestors.rs
--- a/rust/hg-core/src/ancestors.rs Thu Sep 27 16:55:44 2018 +0200
+++ b/rust/hg-core/src/ancestors.rs Mon Oct 08 19:11:41 2018 +0200
@@ -80,6 +80,26 @@
 self.conditionally_push_rev(parents.1);
 Ok(())
 }
+
+/// Consumes partially the iterator to tell if the given target
+/// revision
+/// is in the ancestors it emits.
+/// This is meant for iterators actually dedicated to that kind of
+/// purpose
+pub fn contains(&mut self, target: Revision) -> bool {
+if self.seen.contains(&target) && target != NULL_REVISION {
+return true;
+}
+for rev in self {
+if rev == target {
+return true;
+}
+if rev < target {
+   

Re: [PATCH 2 of 2 V4] rust: rustlazyancestors.__contains__

2018-10-15 Thread Georges Racinet
On 10/14/2018 05:42 PM, Yuya Nishihara wrote:
> On Sun, 14 Oct 2018 15:22:07 +0200, Georges Racinet wrote:
>> # HG changeset patch
>> # User Georges Racinet 
>> # Date 1539018701 -7200
>> #  Mon Oct 08 19:11:41 2018 +0200
>> # Node ID 50d03c9079ffe3932955353be076ff24c4e87804
>> # Parent  c04176c0f8b9aeaf196bd1eac00207d526f3d53b
>> # EXP-Topic rustancestors-contains
>> rust: rustlazyancestors.__contains__
>> +static int rustla_contains(rustlazyancestorsObject *self, PyObject *rev) {
>> +  if (!(PyInt_Check(rev))) {
>> +return 0;
>> +  }
>> +  return rustlazyancestors_contains(self->iter, PyInt_AS_LONG(rev));
>> +}
> Need tabs ;)
yup, sorry, forgot to check that one.
>
>> --- /dev/nullThu Jan 01 00:00:00 1970 +
>> +++ b/rust/hg-direct-ffi/rustfmt.tomlMon Oct 08 19:11:41 2018 +0200
>> @@ -0,0 +1,3 @@
>> +max_width = 79
>> +wrap_comments = true
>> +error_on_line_overflow = true
> Can you send a separate patch for this?
Yes, it has nothing to do in this one
>
>> +int rustlazyancestors_contains(rustlazyancestorsObject *self, long rev);
>> +#[no_mangle]
>> +pub extern "C" fn rustlazyancestors_contains(
>> +raw: *mut AncestorsIterator,
>> +target: c_long,
>> +) -> c_long {
>> +raw_contains(raw, target)
>> +}
> s/-> c_long/-> c_int/

Should be done in V5. Good catch, again

-- 
Georges Racinet
Anybox SAS, http://anybox.fr
Téléphone: +33 6 51 32 07 27
GPG: B59E 22AB B842 CAED 77F7 7A7F C34F A519 33AB 0A35, sur serveurs publics

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


D4312: New bookflow extension for bookmark-based branching

2018-10-15 Thread marcink (Marcin K)
marcink accepted this revision.
marcink added a comment.


  This looks fine to me. Works very well with RhodeCode pull-requests based 
model with bookmark support.

REPOSITORY
  rHG Mercurial

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

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


D4312: New bookflow extension for bookmark-based branching

2018-10-15 Thread idlsoft (Sandu Turcan)
idlsoft added a comment.


  At some point RhodeCode was checking if the destination bookmark was a 
descendant of the source, and not allowing such pull requests to be created.
  That would have to be handled as a fast-forward, in other words just moving 
the destination bookmark.

REPOSITORY
  rHG Mercurial

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

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


D4312: New bookflow extension for bookmark-based branching

2018-10-15 Thread idlsoft (Sandu Turcan)
idlsoft added a comment.


  If this is accepted we might want to look into changing the behavior of `hg 
pull -u`.
  It should update the working directory only if the active bookmark was moved 
remotely.
  I didn't find an easy way to do this without changes to core.

REPOSITORY
  rHG Mercurial

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

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


D4312: New bookflow extension for bookmark-based branching

2018-10-15 Thread markand (David Demelier)
markand added inline comments.

INLINE COMMENTS

> bookflow.py:30
> +
> +configitem(MY_NAME, 'protect', ['@'])
> +configitem(MY_NAME, 'require_bookmark', True)

Please see this: 
https://www.mercurial-scm.org/wiki/UIGuideline#adding_new_options

REPOSITORY
  rHG Mercurial

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

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


D4312: New bookflow extension for bookmark-based branching

2018-10-15 Thread idlsoft (Sandu Turcan)
idlsoft updated this revision to Diff 12149.

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4312?vs=10789&id=12149

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

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

CHANGE DETAILS

diff --git a/tests/test-bookflow.t b/tests/test-bookflow.t
new file mode 100644
--- /dev/null
+++ b/tests/test-bookflow.t
@@ -0,0 +1,284 @@
+initialize
+  $ make_changes() { d=`pwd`; [ ! -z $1 ] && cd $1; echo "test $(basename 
`pwd`)" >> test; hg commit -Am"${2:-test}"; r=$?; cd $d; return $r; }
+  $ ls -1a
+  .
+  ..
+  $ hg init a
+  $ cd a
+  $ echo 'test' > test; hg commit -Am'test'
+  adding test
+
+clone to b
+
+  $ mkdir ../b
+  $ cd ../b
+  $ hg clone ../a .
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo "[extensions]" >> .hg/hgrc
+  $ echo "bookflow=" >> .hg/hgrc
+  $ hg branch X
+  abort: creating named branches is disabled and you should use bookmarks
+  (see 'hg help bookflow')
+  [255]
+  $ hg bookmark X
+  $ hg bookmarks
+  * X 0:* (glob)
+  $ hg bookmark X
+  abort: bookmark X already exists, to move use the --rev option
+  [255]
+  $ make_changes
+  $ hg push ../a -q
+
+  $ hg bookmarks
+   \* X 1:* (glob)
+
+change a
+  $ cd ../a
+  $ hg up
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo 'test' >> test; hg commit -Am'test'
+
+
+pull in b
+  $ cd ../b
+  $ hg pull -u
+  pulling from $TESTTMP/a
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  new changesets * (glob)
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (leaving bookmark X)
+  $ hg status
+  $ hg bookmarks
+ X 1:* (glob)
+
+check protection of @ bookmark
+  $ hg bookmark @
+  $ hg bookmarks
+   \* @ 2:* (glob)
+ X 1:* (glob)
+  $ make_changes
+  abort: cannot commit, bookmark @ is protected
+  [255]
+
+  $ hg status
+  M test
+  $ hg bookmarks
+   \* @ 2:* (glob)
+ X 1:* (glob)
+
+  $ hg --config bookflow.protect= commit  -Am"Updated test"
+
+  $ hg bookmarks
+   \* @ 3:* (glob)
+ X 1:* (glob)
+
+check requirement for an active bookmark
+  $ hg bookmark -i
+  $ hg bookmarks
+ @ 3:* (glob)
+ X 1:* (glob)
+  $ make_changes
+  abort: cannot commit without an active bookmark
+  [255]
+  $ hg revert test
+  $ rm test.orig
+  $ hg status
+
+
+make the bookmark move by updating it on a, and then pulling
+# add a commit to a
+  $ cd ../a
+  $ hg bookmark X
+  $ hg bookmarks
+   \* X 2:* (glob)
+  $ make_changes
+  $ hg bookmarks
+   * X 3:81af7977fdb9
+
+# go back to b, and check out X
+  $ cd ../b
+  $ hg up X
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (activating bookmark X)
+  $ hg bookmarks
+ @ 3:* (glob)
+   \* X 1:* (glob)
+
+# pull, this should move the bookmark forward, because it was changed remotely
+  $ hg pull -u | grep "updating to active bookmark X"
+  updating to active bookmark X
+
+  $ hg bookmarks
+ @ 3:* (glob)
+   * X 4:81af7977fdb9
+
+the bookmark should not move if it diverged from remote
+  $ hg -R ../a status
+  $ hg -R ../b status
+  $ make_changes ../a
+  $ make_changes ../b
+  $ hg -R ../a status
+  $ hg -R ../b status
+  $ hg -R ../a bookmarks
+   * X 4:238292f60a57
+  $ hg -R ../b bookmarks
+ @ 3:* (glob)
+   * X 5:096f7e86892d
+  $ cd ../b
+  $ # make sure we cannot push after bookmarks diverged
+  $ hg push -B X | grep abort
+  abort: push creates new remote head * with bookmark 'X'! (glob)
+  (pull and merge or see 'hg help push' for details about pushing new heads)
+  [1]
+  $ hg pull -u | grep divergent
+  divergent bookmark X stored as X@default
+  1 other divergent bookmarks for "X"
+  $ hg bookmarks
+ @ 3:* (glob)
+   * X 5:096f7e86892d
+ X@default 6:238292f60a57
+  $ hg id -in
+  096f7e86892d 5
+  $ make_changes
+  $ hg status
+  $ hg bookmarks
+ @ 3:* (glob)
+   * X 7:227f941aeb07
+ X@default 6:238292f60a57
+
+now merge with the remote bookmark
+  $ hg merge X@default --tool :local -q
+  $ hg status
+  M test
+  $ hg commit -m"Merged with X@default"
+  $ hg bookmarks
+ @ 3:* (glob)
+   * X 8:26fed9bb3219
+  $ hg push -B X | grep bookmark
+  pushing to $TESTTMP/a (?)
+  updating bookmark X
+  $ cd ../a

D5110: tests: test-parseindex.t requires no-pure

2018-10-15 Thread adgar (Michael Edgar)
adgar created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Custom python code in test-parseindex.t calls reachableroots2 which is only
  available in the C revlog index implementation. Marking it #require no-pure
  ensure it will not run for --pure test runs.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-parseindex.t

CHANGE DETAILS

diff --git a/tests/test-parseindex.t b/tests/test-parseindex.t
--- a/tests/test-parseindex.t
+++ b/tests/test-parseindex.t
@@ -1,3 +1,5 @@
+#require no-pure # pure revlog index does not have reachableroots2 function
+
 revlog.parseindex must be able to parse the index file even if
 an index entry is split between two 64k blocks.  The ideal test
 would be to create an index file with inline data where



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


Re: [PATCH 1 of 2 V5] rust: rustlazyancestors.__contains__

2018-10-15 Thread Yuya Nishihara
On Mon, 15 Oct 2018 11:49:49 +0200, Georges Racinet wrote:
> # HG changeset patch
> # User Georges Racinet 
> # Date 1539018701 -7200
> #  Mon Oct 08 19:11:41 2018 +0200
> # Node ID a7cbd02e936e6724068219ee4c1c50dd4da2b22c
> # Parent  9cadb0f5f2279a60a79b1d0e50eccd60638495c0
> # EXP-Topic rustancestors-contains
> rust: rustlazyancestors.__contains__

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


Re: D5107: localrepo: ensure we properly %-format ints vs strings in exception throw

2018-10-15 Thread Yuya Nishihara
>  raise error.FilteredRepoLookupError(_("filtered revision '%s'")
>  % pycompat.bytestr(changeid))
>  except (IndexError, LookupError):
> +if isinstance(changeid, int):
> +raise error.RepoLookupError(
> +_("unknown revision '%d'") % changeid)
>  raise error.RepoLookupError(_("unknown revision '%s'") % 
> changeid)

Use `pycompat.bytestr(changeid)`? It's worked around as such just a few lines
above.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5107: localrepo: ensure we properly %-format ints vs strings in exception throw

2018-10-15 Thread yuja (Yuya Nishihara)
yuja added a comment.


  >   raise error.FilteredRepoLookupError(_("filtered revision '%s'")
  >   % pycompat.bytestr(changeid))
  >   except (IndexError, LookupError):
  > 
  > +if isinstance(changeid, int):
  >  +raise error.RepoLookupError(
  >  +_("unknown revision '%d'") % changeid)
  > 
  >   raise error.RepoLookupError(_("unknown revision '%s'") % changeid)
  
  Use `pycompat.bytestr(changeid)`? It's worked around as such just a few lines
  above.

REPOSITORY
  rHG Mercurial

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

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


D5109: tests: add missing b prefix in test-context-metadata.t

2018-10-15 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGb8db53f786f0: tests: add missing b prefix in 
test-context-metadata.t (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5109?vs=12141&id=12152

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

AFFECTED FILES
  contrib/python3-whitelist
  tests/test-context-metadata.t

CHANGE DETAILS

diff --git a/tests/test-context-metadata.t b/tests/test-context-metadata.t
--- a/tests/test-context-metadata.t
+++ b/tests/test-context-metadata.t
@@ -22,7 +22,7 @@
   > with repo.wlock(), repo.lock(), repo.transaction(b'metaedit'):
   > old = repo[b'.']
   > kwargs = dict(s.split(b'=', 1) for s in arg.split(b';'))
-  > if 'parents' in kwargs:
+  > if b'parents' in kwargs:
   > kwargs[b'parents'] = map(int, kwargs[b'parents'].split(b','))
   > new = context.metadataonlyctx(repo, old,
   >   **pycompat.strkwargs(kwargs))
diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -89,6 +89,7 @@
 test-config.t
 test-conflict.t
 test-confused-revert.t
+test-context-metadata.t
 test-context.py
 test-contrib-check-code.t
 test-contrib-check-commit.t



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


D5100: notify: a ton of encoding dancing to deal with the email module

2018-10-15 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGf6ef89cf8234: notify: a ton of encoding dancing to deal 
with the email module (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5100?vs=12133&id=12153

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

AFFECTED FILES
  hgext/notify.py

CHANGE DETAILS

diff --git a/hgext/notify.py b/hgext/notify.py
--- a/hgext/notify.py
+++ b/hgext/notify.py
@@ -149,6 +149,7 @@
 
 from mercurial.i18n import _
 from mercurial import (
+encoding,
 error,
 logcmdutil,
 mail,
@@ -361,13 +362,14 @@
 
 p = emailparser.Parser()
 try:
-msg = p.parsestr(data)
+msg = p.parsestr(encoding.strfromlocal(data))
 except emailerrors.MessageParseError as inst:
 raise error.Abort(inst)
 
 # store sender and subject
-sender, subject = msg['From'], msg['Subject']
-del msg['From'], msg['Subject']
+sender = encoding.strtolocal(msg[r'From'])
+subject = encoding.strtolocal(msg[r'Subject'])
+del msg[r'From'], msg[r'Subject']
 
 if not msg.is_multipart():
 # create fresh mime message from scratch
@@ -380,7 +382,8 @@
 for k, v in headers:
 msg[k] = v
 
-msg['Date'] = dateutil.datestr(format="%a, %d %b %Y %H:%M:%S %1%2")
+msg[r'Date'] = encoding.strfromlocal(
+dateutil.datestr(format="%a, %d %b %Y %H:%M:%S %1%2"))
 
 # try to make subject line exist and be useful
 if not subject:
@@ -392,33 +395,34 @@
 maxsubject = int(self.ui.config('notify', 'maxsubject'))
 if maxsubject:
 subject = stringutil.ellipsis(subject, maxsubject)
-msg['Subject'] = mail.headencode(self.ui, subject,
- self.charsets, self.test)
+msg[r'Subject'] = encoding.strfromlocal(
+mail.headencode(self.ui, subject, self.charsets, self.test))
 
 # try to make message have proper sender
 if not sender:
 sender = self.ui.config('email', 'from') or self.ui.username()
 if '@' not in sender or '@localhost' in sender:
 sender = self.fixmail(sender)
-msg['From'] = mail.addressencode(self.ui, sender,
- self.charsets, self.test)
+msg[r'From'] = encoding.strfromlocal(
+mail.addressencode(self.ui, sender, self.charsets, self.test))
 
-msg['X-Hg-Notification'] = 'changeset %s' % ctx
-if not msg['Message-Id']:
-msg['Message-Id'] = ('' %
- (ctx, int(time.time()),
-  hash(self.repo.root), socket.getfqdn()))
-msg['To'] = ', '.join(sorted(subs))
+msg[r'X-Hg-Notification'] = r'changeset %s' % ctx
+if not msg[r'Message-Id']:
+msg[r'Message-Id'] = encoding.strfromlocal(
+'' % (ctx, int(time.time()),
+  hash(self.repo.root),
+  encoding.strtolocal(socket.getfqdn(
+msg[r'To'] = encoding.strfromlocal(', '.join(sorted(subs)))
 
-msgtext = msg.as_string()
+msgtext = encoding.strtolocal(msg.as_string())
 if self.test:
 self.ui.write(msgtext)
 if not msgtext.endswith('\n'):
 self.ui.write('\n')
 else:
 self.ui.status(_('notify: sending %d subscribers %d changes\n') %
(len(subs), count))
-mail.sendmail(self.ui, stringutil.email(msg['From']),
+mail.sendmail(self.ui, stringutil.email(msg[r'From']),
   subs, msgtext, mbox=self.mbox)
 
 def diff(self, ctx, ref=None):



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


D5108: context: raise runtime errors with sysstrs

2018-10-15 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGaf2306bf7d5d: context: raise runtime errors with sysstrs 
(authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5108?vs=12140&id=12151

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

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
@@ -2337,11 +2337,11 @@
 # manifests of our commit parents
 mp1, mp2 = self.manifestctx().parents
 if p1 != nullid and p1.manifestnode() != mp1:
-raise RuntimeError('can\'t reuse the manifest: '
-   'its p1 doesn\'t match the new ctx p1')
+raise RuntimeError(r"can't reuse the manifest: its p1 "
+   r"doesn't match the new ctx p1")
 if p2 != nullid and p2.manifestnode() != mp2:
-raise RuntimeError('can\'t reuse the manifest: '
-   'its p2 doesn\'t match the new ctx p2')
+raise RuntimeError(r"can't reuse the manifest: "
+   r"its p2 doesn't match the new ctx p2")
 
 self._files = originalctx.files()
 self.substate = {}



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


D5061: f: fix a Python 3 bytes/string issue

2018-10-15 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGda1629c7dda1: f: fix a Python 3 bytes/string issue 
(authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5061?vs=12070&id=12155

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

AFFECTED FILES
  tests/f

CHANGE DETAILS

diff --git a/tests/f b/tests/f
--- a/tests/f
+++ b/tests/f
@@ -88,9 +88,11 @@
 if opts.newer:
 # mtime might be in whole seconds so newer file might be same
 if stat.st_mtime >= os.stat(opts.newer).st_mtime:
-facts.append(b'newer than %s' % opts.newer)
+facts.append(b'newer than %s' % opts.newer.encode(
+'utf8', 'replace'))
 else:
-facts.append(b'older than %s' % opts.newer)
+facts.append(b'older than %s' % opts.newer.encode(
+'utf8', 'replace'))
 if opts.md5 and content is not None:
 h = hashlib.md5(content)
 facts.append(b'md5=%s' % binascii.hexlify(h.digest())[:opts.bytes])



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


D5104: tests: use regex instead of Python versions for archive hash changes

2018-10-15 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG6519f5aee06f: tests: use regex instead of Python versions 
for archive hash changes (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5104?vs=12132&id=12154

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

AFFECTED FILES
  tests/test-archive.t

CHANGE DETAILS

diff --git a/tests/test-archive.t b/tests/test-archive.t
--- a/tests/test-archive.t
+++ b/tests/test-archive.t
@@ -187,8 +187,7 @@
   server: testing stub value
   transfer-encoding: chunked
   
-  body: size=1377, sha1=677b14d3d048778d5eb5552c14a67e6192068650 (no-py3 !)
-  body: size=1461, sha1=be6d3983aa13dfe930361b2569291cdedd02b537 (py3 !)
+  body: size=(1377|1461), 
sha1=(677b14d3d048778d5eb5552c14a67e6192068650|be6d3983aa13dfe930361b2569291cdedd02b537)
 (re)
   % tar.gz and tar.bz2 disallowed should both give 403
   403 Archive type not allowed: gz
   content-type: text/html; charset=ascii
@@ -275,8 +274,7 @@
   server: testing stub value
   transfer-encoding: chunked
   
-  body: size=1377, sha1=677b14d3d048778d5eb5552c14a67e6192068650 (no-py3 !)
-  body: size=1461, sha1=be6d3983aa13dfe930361b2569291cdedd02b537 (py3 !)
+  body: size=(1377|1461), 
sha1=(677b14d3d048778d5eb5552c14a67e6192068650|be6d3983aa13dfe930361b2569291cdedd02b537)
 (re)
   % tar.gz and tar.bz2 disallowed should both give 403
   403 Archive type not allowed: gz
   content-type: text/html; charset=ascii



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


[Bug 5999] New: Build bots need the vcr module installed

2018-10-15 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=5999

Bug ID: 5999
   Summary: Build bots need the vcr module installed
   Product: Mercurial project
   Version: unspecified
  Hardware: All
OS: All
Status: UNCONFIRMED
  Severity: feature
  Priority: normal
 Component: infrastructure
  Assignee: bugzi...@mercurial-scm.org
  Reporter: matt_harbi...@yahoo.com
CC: kbullock+mercur...@ringworld.org,
mercurial-devel@mercurial-scm.org

Without it, they all skip the phabricator test, which is currently broken.  (It
seems to be a problem with the test itself, not the extension functionality.)

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


[PATCH] py3: byteify extension in test-relink.t

2018-10-15 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1539536753 14400
#  Sun Oct 14 13:05:53 2018 -0400
# Node ID bb67d54942a16a556cdf257d67ef8f98638728a7
# Parent  0947a5818862b8cbd0689d9bb943baa35361a436
py3: byteify extension in test-relink.t

diff --git a/tests/test-relink.t b/tests/test-relink.t
--- a/tests/test-relink.t
+++ b/tests/test-relink.t
@@ -11,9 +11,12 @@
   > from __future__ import absolute_import, print_function
   > import os
   > import sys
-  > from mercurial import util
+  > from mercurial import (
+  > pycompat,
+  > util,
+  > )
   > path1, path2 = sys.argv[1:3]
-  > if util.samefile(path1, path2):
+  > if util.samefile(pycompat.fsencode(path1), pycompat.fsencode(path2)):
   > print('%s == %s' % (path1, path2))
   > else:
   > print('%s != %s' % (path1, path2))
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5025: py3: make test-contrib-perf.t work on python 3

2018-10-15 Thread mharbison72 (Matt Harbison)
mharbison72 added a comment.


  In https://phab.mercurial-scm.org/D5025#75556, @yuja wrote:
  
  > >   def perfstartup(ui, repo, **opts):
  > >   opts = _byteskwargs(opts)
  > >   timer, fm = gettimer(ui, opts)
  > > 
  > > - cmd = sys.argv[0] +cmd = fsencode(sys.argv[0])
  >
  > Applying fsencode() on sys.argv is probably wrong on Windows, but it's 
perf.py,
  >  I don't care.
  
  
  Sadly, it doesn't work on Windows.  But since os.system() is called with an 
r-string, bytes wouldn't be right anyway.  When I simply formatted in 
sys.argv[0], I got this:
  
--- c:/Users/Matt/projects/hg_py3/tests/test-contrib-perf.t
+++ c:/Users/Matt/projects/hg_py3/tests/test-contrib-perf.t.err
@@ -184,6 +184,7 @@
   $ hg perfrevrange
   $ hg perfrevset 'all()'
   $ hg perfstartup
+  (null): can't open file '': [Errno 2] $ENOENT$
   $ hg perfstatus
   $ hg perftags
   $ hg perftemplating
  
  This will be good to figure out because there are ~400 other instances of 
this error, mostly around launching hooks.  What I've found to work (both here 
and for the hooks) is to make sure that python3 is launched:
  
os.system(r"py -3 %s version -q > NUL" % sys.argv[0])
  
  It's perfectly capable of running `r'notepad'`, so this must be an 
hg.exe/python.exe issue.  This probably gets messy (at least with the hooks) 
because *.py files are associated with python2, and python2 is in $PATH (but 
not python3- both of which are named python.exe).  `py -3` will also pay 
attention to the shbang line, all of which are coded to python2.  The only 
other thing of note that I see is that wrapper.exe implements main() and not 
wmain(), but I can't believe that py3 is incapable of launching things built 
without Unicode support.

REPOSITORY
  rHG Mercurial

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

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


D5025: py3: make test-contrib-perf.t work on python 3

2018-10-15 Thread mharbison72 (Matt Harbison)
mharbison72 added a comment.


  In https://phab.mercurial-scm.org/D5025#76443, @mharbison72 wrote:
  
  > In https://phab.mercurial-scm.org/D5025#75556, @yuja wrote:
  >
  > > >   def perfstartup(ui, repo, **opts):
  > > >   opts = _byteskwargs(opts)
  > > >   timer, fm = gettimer(ui, opts)
  > > > 
  > > > - cmd = sys.argv[0] +cmd = fsencode(sys.argv[0])
  > >
  > > Applying fsencode() on sys.argv is probably wrong on Windows, but it's 
perf.py,
  > >  I don't care.
  >
  >
  > Sadly, it doesn't work on Windows.  But since os.system() is called with an 
r-string, bytes wouldn't be right anyway.  When I simply formatted in 
sys.argv[0], I got this:
  >
  >   --- c:/Users/Matt/projects/hg_py3/tests/test-contrib-perf.t
  >   +++ c:/Users/Matt/projects/hg_py3/tests/test-contrib-perf.t.err
  >   @@ -184,6 +184,7 @@
  >  $ hg perfrevrange
  >  $ hg perfrevset 'all()'
  >  $ hg perfstartup
  >   +  (null): can't open file '': [Errno 2] $ENOENT$
  >  $ hg perfstatus
  >  $ hg perftags
  >  $ hg perftemplating
  >
  >
  > This will be good to figure out because there are ~400 other instances of 
this error, mostly around launching hooks.
  
  
  Nevermind.  Looking closer at exewrapper.c, the signature of Py_Main() 
changed.  Is there any reason not to convert that file to the usual TCHAR type, 
and #define UNICODE when building for py3?

REPOSITORY
  rHG Mercurial

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

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