[PATCH 2 of 2] byteify-strings: fix misalignment with multi-line parenthesis

2019-08-04 Thread Raphaël Gomès
# HG changeset patch
# User Raphaël Gomès 
# Date 1564949666 -7200
#  Sun Aug 04 22:14:26 2019 +0200
# Node ID 3d9a2bb7d210b8fc092894fec7017faad9653496
# Parent  6a81e45cb9f295adff1e8008a67db48b971ccc18
# EXP-Topic byteify-strings
byteify-strings: fix misalignment with multi-line parenthesis

This improves the current fix to also take into account cases where the last
line ended on the opening `(`, `[` or `{` and adds a regression test.

diff -r 6a81e45cb9f2 -r 3d9a2bb7d210 contrib/byteify-strings.py
--- a/contrib/byteify-strings.pyFri Aug 02 16:54:02 2019 +0200
+++ b/contrib/byteify-strings.pySun Aug 04 22:14:26 2019 +0200
@@ -132,11 +132,15 @@
 # the current line will be aligned to the last opening paren
 # as before.
 if coloffset < 0:
-if t.start[1] == parens[-1][1]:
-coloffset = parens[-1][2]
-elif t.start[1] + 1 == parens[-1][1]:
+lastparen = parens[-1]
+if t.start[1] == lastparen[1]:
+coloffset = lastparen[2]
+elif (
+t.start[1] + 1 == lastparen[1]
+and lastparen[3] not in (token.NEWLINE, tokenize.NL)
+):
 # fix misaligned indent of s/util.Abort/error.Abort/
-coloffset = parens[-1][2] + (parens[-1][1] - t.start[1])
+coloffset = lastparen[2] + (lastparen[1] - t.start[1])
 else:
 coloffset = 0
 
@@ -164,7 +168,7 @@
 
 # Remember the last paren position.
 if _isop(i, '(', '[', '{'):
-parens.append(t.end + (coloffset + coldelta,))
+parens.append(t.end + (coloffset + coldelta, tokens[i + 1].type))
 elif _isop(i, ')', ']', '}'):
 parens.pop()
 
diff -r 6a81e45cb9f2 -r 3d9a2bb7d210 tests/test-byteify-strings.t
--- a/tests/test-byteify-strings.t  Fri Aug 02 16:54:02 2019 +0200
+++ b/tests/test-byteify-strings.t  Sun Aug 04 22:14:26 2019 +0200
@@ -199,3 +199,47 @@
   $ byteify_strings testfile.py
   obj[b'test'] = b"1234"
   obj[r'test'] = u"1234"
+
+Test multi-line alignment
+
+  $ cat > testfile.py <<'EOF'
+  > def foo():
+  > error.Abort(_("foo"
+  >  "bar"
+  >  "%s")
+  >% parameter)
+  > {
+  > 'test': dict,
+  > 'test2': dict,
+  > }
+  > [
+  >"thing",
+  >"thing2"
+  > ]
+  > (
+  >"tuple",
+  >"tuple2",
+  > )
+  > {"thing",
+  >  }
+  > EOF
+  $ byteify_strings testfile.py
+  def foo():
+  error.Abort(_(b"foo"
+b"bar"
+b"%s")
+  % parameter)
+  {
+  b'test': dict,
+  b'test2': dict,
+  }
+  [
+ b"thing",
+ b"thing2"
+  ]
+  (
+ b"tuple",
+ b"tuple2",
+  )
+  {b"thing",
+   }
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 2] byteify-strings: add test for byteify-strings.py

2019-08-04 Thread Raphaël Gomès
# HG changeset patch
# User Raphaël Gomès 
# Date 1564757642 -7200
#  Fri Aug 02 16:54:02 2019 +0200
# Node ID 6a81e45cb9f295adff1e8008a67db48b971ccc18
# Parent  bbb002b378f33620d70d71872c869f3d67262ddf
# EXP-Topic byteify-strings
byteify-strings: add test for byteify-strings.py

This tests the basic features expected from this script, some cases may not
be covered yet.

A future patch will demonstrate an issue with multi-line `(`, `[` and `{`
alignment and propose a fix.

diff -r bbb002b378f3 -r 6a81e45cb9f2 tests/test-byteify-strings.t
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ b/tests/test-byteify-strings.t  Fri Aug 02 16:54:02 2019 +0200
@@ -0,0 +1,201 @@
+#require py3
+
+  $ byteify_strings () {
+  >   $PYTHON "$TESTDIR/../contrib/byteify-strings.py" "$@"
+  > }
+
+Test in-place
+
+  $ cat > testfile.py < obj['test'] = b"1234"
+  > mydict.iteritems()
+  > EOF
+  $ byteify_strings testfile.py -i
+  $ cat testfile.py
+  obj[b'test'] = b"1234"
+  mydict.iteritems()
+
+Test with dictiter
+
+  $ cat > testfile.py < obj['test'] = b"1234"
+  > mydict.iteritems()
+  > EOF
+  $ byteify_strings testfile.py --dictiter
+  obj[b'test'] = b"1234"
+  mydict.items()
+
+Test kwargs-like objects
+
+  $ cat > testfile.py < kwargs['test'] = "123"
+  > kwargs[test['testing']]
+  > kwargs[test[[['testing'
+  > kwargs[kwargs['testing']]
+  > kwargs.get('test')
+  > kwargs.pop('test')
+  > kwargs.get('test', 'testing')
+  > kwargs.pop('test', 'testing')
+  > kwargs.setdefault('test', 'testing')
+  > 
+  > opts['test'] = "123"
+  > opts[test['testing']]
+  > opts[test[[['testing'
+  > opts[opts['testing']]
+  > opts.get('test')
+  > opts.pop('test')
+  > opts.get('test', 'testing')
+  > opts.pop('test', 'testing')
+  > opts.setdefault('test', 'testing')
+  > 
+  > commitopts['test'] = "123"
+  > commitopts[test['testing']]
+  > commitopts[test[[['testing'
+  > commitopts[commitopts['testing']]
+  > commitopts.get('test')
+  > commitopts.pop('test')
+  > commitopts.get('test', 'testing')
+  > commitopts.pop('test', 'testing')
+  > commitopts.setdefault('test', 'testing')
+  > EOF
+  $ byteify_strings testfile.py --treat-as-kwargs kwargs opts commitopts
+  kwargs['test'] = b"123"
+  kwargs[test[b'testing']]
+  kwargs[test[[[b'testing'
+  kwargs[kwargs['testing']]
+  kwargs.get('test')
+  kwargs.pop('test')
+  kwargs.get('test', b'testing')
+  kwargs.pop('test', b'testing')
+  kwargs.setdefault('test', b'testing')
+  
+  opts['test'] = b"123"
+  opts[test[b'testing']]
+  opts[test[[[b'testing'
+  opts[opts['testing']]
+  opts.get('test')
+  opts.pop('test')
+  opts.get('test', b'testing')
+  opts.pop('test', b'testing')
+  opts.setdefault('test', b'testing')
+  
+  commitopts['test'] = b"123"
+  commitopts[test[b'testing']]
+  commitopts[test[[[b'testing'
+  commitopts[commitopts['testing']]
+  commitopts.get('test')
+  commitopts.pop('test')
+  commitopts.get('test', b'testing')
+  commitopts.pop('test', b'testing')
+  commitopts.setdefault('test', b'testing')
+
+Test attr*() as methods
+
+  $ cat > testfile.py < setattr(o, 'a', 1)
+  > util.setattr(o, 'ae', 1)
+  > util.getattr(o, 'alksjdf', 'default')
+  > util.addattr(o, 'asdf')
+  > util.hasattr(o, 'lksjdf', 'default')
+  > util.safehasattr(o, 'lksjdf', 'default')
+  > @eh.wrapfunction(func, 'lksjdf')
+  > @eh.wrapclass(klass, 'lksjdf')
+  > EOF
+  $ byteify_strings testfile.py --allow-attr-methods
+  setattr(o, 'a', 1)
+  util.setattr(o, 'ae', 1)
+  util.getattr(o, 'alksjdf', b'default')
+  util.addattr(o, 'asdf')
+  util.hasattr(o, 'lksjdf', b'default')
+  util.safehasattr(o, 'lksjdf', b'default')
+  @eh.wrapfunction(func, 'lksjdf')
+  @eh.wrapclass(klass, 'lksjdf')
+
+Test without attr*() as methods
+
+  $ cat > testfile.py < setattr(o, 'a', 1)
+  > util.setattr(o, 'ae', 1)
+  > util.getattr(o, 'alksjdf', 'default')
+  > util.addattr(o, 'asdf')
+  > util.hasattr(o, 'lksjdf', 'default')
+  > util.safehasattr(o, 'lksjdf', 'default')
+  > @eh.wrapfunction(func, 'lksjdf')
+  > @eh.wrapclass(klass, 'lksjdf')
+  > EOF
+  $ byteify_strings testfile.py
+  setattr(o, 'a', 1)
+  util.setattr(o, b'ae', 1)
+  util.getattr(o, b'alksjdf', b'default')
+  util.addattr(o, b'asdf')
+  util.hasattr(o, b'lksjdf', b'default')
+  util.safehasattr(o, b'lksjdf', b'default')
+  @eh.wrapfunction(func, b'lksjdf')
+  @eh.wrapclass(klass, b'lksjdf')
+
+Test ignore comments
+
+  $ cat > testfile.py < #py3-transform: off
+  > "none"
+  > "of"
+  > 'these'
+  > s = """should"""
+  > d = '''be'''
+  > #py3-transform: on
+  > "this should"
+  > 'and this also'
+  > 
+  > #no-py3-transform
+  > l = "this should be ignored"
+  > l2 = "this shouldn't"
+  > 
+  > EOF
+  $ byteify_strings testfile.py
+  #py3-transform: off
+  "none"
+  "of"
+  'these'
+  s = """should"""
+  d = '''be'''
+  #py3-transform: on
+  b"this should"
+  b'and this also'
+  
+  #no-py3-transform
+  l = "this should be ignored"
+  l2 = b"this shouldn't"
+  
+Test triple-quoted strings
+
+  $ cat 

D6718: repository: suppress typing errors on functions without arguments

2019-08-04 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  zope.interface uses class magic to define interfaces. Mypy doesn't
  like the methods without arguments and raises a warning for the
  dozens of them in repository.py.
  
  This commit adds type annotation comments to silence the error.
  TBH I'm not sure if this is the best way to do this. But it does
  get the job done. We may have to revisit once we add proper type
  annotations to this file. For now, it makes mypy's output far
  less verbose.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/repository.py

CHANGE DETAILS

diff --git a/mercurial/repository.py b/mercurial/repository.py
--- a/mercurial/repository.py
+++ b/mercurial/repository.py
@@ -55,7 +55,7 @@
 """
 ui = interfaceutil.Attribute("""ui.ui instance""")
 
-def url():
+def url():  # type: ignore
 """Returns a URL string representing this peer.
 
 Currently, implementations expose the raw URL used to construct the
@@ -67,23 +67,23 @@
 value.
 """
 
-def local():
+def local():  # type: ignore
 """Returns a local repository instance.
 
 If the peer represents a local repository, returns an object that
 can be used to interface with it. Otherwise returns ``None``.
 """
 
-def peer():
+def peer():  # type: ignore
 """Returns an object conforming to this interface.
 
 Most implementations will ``return self``.
 """
 
-def canpush():
+def canpush():  # type: ignore
 """Returns a boolean indicating if this peer can be pushed to."""
 
-def close():
+def close():  # type: ignore
 """Close the connection to this peer.
 
 This is called when the peer will no longer be used. Resources
@@ -117,20 +117,20 @@
 methods commonly call wire protocol commands of the same name.
 """
 
-def branchmap():
+def branchmap():  # type: ignore
 """Obtain heads in named branches.
 
 Returns a dict mapping branch name to an iterable of nodes that are
 heads on that branch.
 """
 
-def capabilities():
+def capabilities():  # type: ignore
 """Obtain capabilities of the peer.
 
 Returns a set of string capabilities.
 """
 
-def clonebundles():
+def clonebundles():  # type: ignore
 """Obtains the clone bundles manifest for the repo.
 
 Returns the manifest as unparsed bytes.
@@ -148,7 +148,7 @@
 Returns a generator of bundle data.
 """
 
-def heads():
+def heads():  # type: ignore
 """Determine all known head revisions in the peer.
 
 Returns an iterable of binary nodes.
@@ -185,7 +185,7 @@
 namespace.
 """
 
-def stream_out():
+def stream_out():  # type: ignore
 """Obtain streaming clone data.
 
 Successful result should be a generator of data chunks.
@@ -262,7 +262,7 @@
 until all command requests have been issued.
 """
 
-def sendcommands():
+def sendcommands():  # type: ignore
 """Trigger submission of queued command requests.
 
 Not all transports submit commands as soon as they are requested to
@@ -272,7 +272,7 @@
 When called, no more new commands may be issued with this executor.
 """
 
-def close():
+def close():  # type: ignore
 """Signal that this command request is finished.
 
 When called, no more new commands may be issued. All outstanding
@@ -295,7 +295,7 @@
 """True if the peer cannot receive large argument value for 
commands."""
 )
 
-def commandexecutor():
+def commandexecutor():  # type: ignore
 """A context manager that resolves to an ipeercommandexecutor.
 
 The object this resolves to can be used to issue command requests
@@ -439,7 +439,7 @@
 in the index.
 """
 
-def __len__():
+def __len__():  # type: ignore
 """The total number of revisions."""
 
 def __getitem__(rev):
@@ -491,10 +491,10 @@
 * DAG data (storing and querying the relationship between nodes).
 * Metadata to facilitate storage.
 """
-def __len__():
+def __len__():  # type: ignore
 """Obtain the number of revisions stored for this file."""
 
-def __iter__():
+def __iter__():  # type: ignore
 """Iterate over revision numbers for this file."""
 
 def hasnode(node):
@@ -770,7 +770,7 @@
 class ifilestorage(ifileindex, ifiledata, ifilemutation):
 """Complete storage interface for a single tracked file."""
 
-def files():
+def files():  # type: ignore
 """Obtain paths that are backing storage for this file.
 
 TODO this is used heavily by verify code and there should probably
@@ -847,7 +847,7 @@
 directory is removed from the collection.
  

D6717: mypy: add a mypy.ini config file

2019-08-04 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Static analysis is good. Let's encourage its use by adding
  a mypy.ini config file to the repo that has reasonable defaults.
  
  With this file in place, `mypy` appears to "just work" out of
  the box. It yields a ton of errors and warnings though. But
  it's a start!

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mypy.ini

CHANGE DETAILS

diff --git a/mypy.ini b/mypy.ini
new file mode 100644
--- /dev/null
+++ b/mypy.ini
@@ -0,0 +1,29 @@
+# To run mypy against Mercurial, do something like the following:
+#
+#   $ python3.7 -m pip install mypy
+#   $ python3.7 mypy
+#
+# Note: Mercurial's source tree has source files that may not parse
+# on the version of Python being targeted. Currently released versions
+# of mypy treat parse errors as fatal. To work around this, install
+# a mypy with the change from https://github.com/python/mypy/pull/7286
+# and uncomment the `ignore_parse_errors` line below.
+
+[mypy]
+files = hgext/**/*.py, hgdemandimport/**/*.py, mercurial/**/*.py
+cache_dir = build/mypy-cache
+
+# By default mypy targets the Python version it runs as. Mypy requires
+# Python 3.5 to run.
+python_version = 2.7
+
+# Various functionality is optional. Suppress missing imports globally
+# to cut down on noise.
+ignore_missing_imports = True
+
+# TODO enable once feature lands upstream
+# ignore_parse_errors = True
+
+# We don't control third party code. Don't error on it.
+[mypy-mercurial.thirdparty.*]
+ignore_errors = True



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


D6714: automation: update packages in requirements files

2019-08-04 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added subscribers: mercurial-devel, mjpieters.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  We like keeping up to date. The content of the autogenerated files
  changed slightly because I used a newer version of `pip-compile`
  than what was used previously.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/automation/linux-requirements-py2.txt
  contrib/automation/linux-requirements-py3.txt

CHANGE DETAILS

diff --git a/contrib/automation/linux-requirements-py3.txt 
b/contrib/automation/linux-requirements-py3.txt
--- a/contrib/automation/linux-requirements-py3.txt
+++ b/contrib/automation/linux-requirements-py3.txt
@@ -2,16 +2,16 @@
 # This file is autogenerated by pip-compile
 # To update, run:
 #
-#pip-compile -U --generate-hashes --output-file 
contrib/automation/linux-requirements-py3.txt 
contrib/automation/linux-requirements.txt.in
+#pip-compile --generate-hashes 
--output-file=contrib/automation/linux-requirements-py3.txt 
contrib/automation/linux-requirements.txt.in
 #
 astroid==2.2.5 \
 
--hash=sha256:6560e1e1749f68c64a4b5dee4e091fce798d2f0d84ebe638cf0e0585a343acf4 \
 
--hash=sha256:b65db1bbaac9f9f4d190199bb8680af6f6f84fd3769a5ea883df8a91fe68b4c4 \
 # via pylint
-docutils==0.14 \
-
--hash=sha256:02aec4bd92ab067f6ff27a38a38a41173bf01bed8f89157768c1573f53e474a6 \
-
--hash=sha256:51e64ef2ebfb29cae1faa133b3710143496eca21c530f3f71424d77687764274 \
-
--hash=sha256:7a4bd47eaf6596e1295ecb11361139febe29b084a87bf005bf899f9a42edc3c6
+docutils==0.15.2 \
+
--hash=sha256:6c4f696463b79f1fb8ba0c594b63840ebd41f059e92b31957c46b74a4599b6d0 \
+
--hash=sha256:9e4d7ecfc600058e07ba661411a2b7de2fd0fafa17d1a7f7361cd47b1175c827 \
+
--hash=sha256:a2aeea129088da402665e92e0b25b04b073c04b2dce4ab65caaa38b7ce2e1a99
 fuzzywuzzy==0.17.0 \
 
--hash=sha256:5ac7c0b3f4658d2743aa17da53a55598144edbc5bee3c6863840636e6926f254 \
 
--hash=sha256:6f49de47db00e1c71d40ad16da42284ac357936fa9b66bea1df63fed07122d62
@@ -19,40 +19,29 @@
 
--hash=sha256:c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407 \
 
--hash=sha256:ea8b7f6188e6fa117537c3df7da9fc686d485087abf6ac197f9c46432f7e4a3c \
 # via yarl
-isort==4.3.17 \
-
--hash=sha256:01cb7e1ca5e6c5b3f235f0385057f70558b70d2f00320208825fa62887292f43 \
-
--hash=sha256:268067462aed7eb2a1e237fcb287852f22077de3fb07964e87e00f829eea2d1a \
+isort==4.3.21 \
+
--hash=sha256:54da7e92468955c4fceacd0c86bd0ec997b0e1ee80d97f67c35a78b719dccab1 \
+
--hash=sha256:6e811fcb295968434526407adb8796944f1988c5b65e8139058f2014cbe100fd \
 # via pylint
-lazy-object-proxy==1.3.1 \
-
--hash=sha256:0ce34342b419bd8f018ebfef729aec3edf62345a53b537a4dcc115746a33 \
-
--hash=sha256:1b668120716eb7ee21d8a38815e5eb3bb827d9a90b0f8e21722c0758cc39 \
-
--hash=sha256:209615b0fe4624d79e50220ce3310ca1a9445fd8e6d3572a896e7f9146bbf019 \
-
--hash=sha256:27bf62cb2b1a2068d443ff7097ee33393f8483b570b475db8ebf7e1cba64f088 \
-
--hash=sha256:27ea6fd1c02dcc78172a82fc37fcc0992a94e4cecf53cb6d73f11749825bd98b \
-
--hash=sha256:2c1b21b44ac9beb0fc848d3993924147ba45c4ebc24be19825e57aabbe74a99e \
-
--hash=sha256:2df72ab12046a3496a92476020a1a0abf78b2a7db9ff4dc2036b8dd980203ae6 \
-
--hash=sha256:320ffd3de9699d3892048baee45ebfbbf9388a7d65d832d7e580243ade426d2b \
-
--hash=sha256:50e3b9a464d5d08cc5227413db0d1c4707b6172e4d4d915c1c70e4de0bbff1f5 \
-
--hash=sha256:5276db7ff62bb7b52f77f1f51ed58850e315154249aceb42e7f4c611f0f847ff \
-
--hash=sha256:61a6cf00dcb1a7f0c773ed4acc509cb636af2d6337a08f362413c76b2b47a8dd \
-
--hash=sha256:6ae6c4cb59f199d8827c5a07546b2ab7e85d262acaccaacd49b62f53f7c456f7 \
-
--hash=sha256:7661d401d60d8bf15bb5da39e4dd72f5d764c5aff5a86ef52a042506e3e970ff \
-
--hash=sha256:7bd527f36a605c914efca5d3d014170b2cb184723e423d26b1fb2fd9108e264d \
-
--hash=sha256:7cb54db3535c8686ea12e9535eb087d32421184eacc6939ef15ef50f83a5e7e2 \
-
--hash=sha256:7f3a2d740291f7f2c111d86a1c4851b70fb000a6c8883a59660d95ad57b9df35 \
-
--hash=sha256:81304b7d8e9c824d058087dcb89144842c8e0dea6d281c031f59f0acf66963d4 \
-
--hash=sha256:933947e8b4fbe617a51528b09851685138b49d511af0b6c0da2539115d6d4514 \
-
--hash=sha256:94223d7f060301b3a8c09c9b3bc3294b56b2188e7d8179c762a1cda72c979252 \
-
--hash=sha256:ab3ca49afcb47058393b0122428358d2fbe0408cf99f1b58b295cfeb4ed39109 \
-
--hash=sha256:bd6292f565ca46dee4e737ebcc20742e3b5be2b01556dafe169f6c65d088875f \
-
--hash=sha256:cb924aa3e4a3fb644d0c463cad5bc2572649a6a3f68a7f8e4fbe44aaa6d77e4c \
-
--hash=sha256:d0fc7a286feac9077ec52a927fc9fe8fe2fabab95426722be4c953c9a8bede92 \
-
--hash=sha256:ddc34786490a6e4ec0a855d401034cbd1242ef186c20d79d2166d6a4bd449577 \
-
--hash=sha256:e34b155e36fa9da7e1b7c738ed7767fc9491a62ec6af70fe9da4a057759edc2d \
-
--hash=sha256:e5b9e8f6bda48460b7b143c3821b21b452cb3a835e6bbd5dd33aa0c8d3f5137d \
-

D6716: automation: increase root volume size on Linux

2019-08-04 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  It is close to full in the AMI. I actually ran out of space running
  tests without increasing the volume size!

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/automation/hgautomation/aws.py

CHANGE DETAILS

diff --git a/contrib/automation/hgautomation/aws.py 
b/contrib/automation/hgautomation/aws.py
--- a/contrib/automation/hgautomation/aws.py
+++ b/contrib/automation/hgautomation/aws.py
@@ -970,7 +970,7 @@
 'DeviceName': image.block_device_mappings[0]['DeviceName'],
 'Ebs': {
 'DeleteOnTermination': True,
-'VolumeSize': 8,
+'VolumeSize': 12,
 'VolumeType': 'gp2',
 },
 }



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


D6715: automation: install Rust in Linux environment

2019-08-04 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This will install Rust 1.31.1, 1.34.2, and whatever stable is at
  the time the install runs. We install 1.31.1 as our minimum supported
  Rust version (I think that's what we're currently targeting) and
  1.34 because that's what Debian 10 is shipping.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/automation/hgautomation/linux.py

CHANGE DETAILS

diff --git a/contrib/automation/hgautomation/linux.py 
b/contrib/automation/hgautomation/linux.py
--- a/contrib/automation/hgautomation/linux.py
+++ b/contrib/automation/hgautomation/linux.py
@@ -65,6 +65,18 @@
 '''.lstrip().replace('\r\n', '\n')
 
 
+INSTALL_RUST = r'''
+RUSTUP_INIT_SHA256=a46fe67199b7bcbbde2dcbc23ae08db6f29883e260e23899a88b9073effc9076
+wget -O rustup-init --progress dot:mega 
https://static.rust-lang.org/rustup/archive/1.18.3/x86_64-unknown-linux-gnu/rustup-init
+echo "${RUSTUP_INIT_SHA256} rustup-init" | sha256sum --check -
+
+chmod +x rustup-init
+sudo -H -u hg -g hg ./rustup-init -y
+sudo -H -u hg -g hg /home/hg/.cargo/bin/rustup install 1.31.1 1.34.2
+sudo -H -u hg -g hg /home/hg/.cargo/bin/rustup component add clippy
+'''
+
+
 BOOTSTRAP_VIRTUALENV = r'''
 /usr/bin/virtualenv /hgdev/venv-bootstrap
 
@@ -286,6 +298,8 @@
 # Will be normalized to hg:hg later.
 sudo chown `whoami` /hgdev
 
+{install_rust}
+
 cp requirements-py2.txt /hgdev/requirements-py2.txt
 cp requirements-py3.txt /hgdev/requirements-py3.txt
 
@@ -309,6 +323,7 @@
 
 sudo chown -R hg:hg /hgdev
 '''.lstrip().format(
+install_rust=INSTALL_RUST,
 install_pythons=INSTALL_PYTHONS,
 bootstrap_virtualenv=BOOTSTRAP_VIRTUALENV
 ).replace('\r\n', '\n')



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


D6713: automation: install latest Python versions

2019-08-04 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added subscribers: mercurial-devel, mjpieters.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This required bumping the pyenv commit so the new versions are
  available.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/automation/hgautomation/linux.py

CHANGE DETAILS

diff --git a/contrib/automation/hgautomation/linux.py 
b/contrib/automation/hgautomation/linux.py
--- a/contrib/automation/hgautomation/linux.py
+++ b/contrib/automation/hgautomation/linux.py
@@ -28,11 +28,11 @@
 
 INSTALL_PYTHONS = r'''
 PYENV2_VERSIONS="2.7.16 pypy2.7-7.1.1"
-PYENV3_VERSIONS="3.5.7 3.6.8 3.7.3 3.8-dev pypy3.5-7.0.0 pypy3.6-7.1.1"
+PYENV3_VERSIONS="3.5.7 3.6.9 3.7.4 3.8-dev pypy3.5-7.0.0 pypy3.6-7.1.1"
 
 git clone https://github.com/pyenv/pyenv.git /hgdev/pyenv
 pushd /hgdev/pyenv
-git checkout 3faeda67bb33e07750d1a104271369a7384ca45c
+git checkout 17f44b7cd6f58ea2fa68ec0371fb9e7a826b8be2
 popd
 
 export PYENV_ROOT="/hgdev/pyenv"



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


D6659: graft: split graft code into seperate functions

2019-08-04 Thread taapas1128 (Taapas Agrawal)
taapas1128 added a comment.


  @martinvonz @durin42 Have a look I ve updated the patch.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6659/new/

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

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


D6665: continue: added support for graft

2019-08-04 Thread taapas1128 (Taapas Agrawal)
taapas1128 updated this revision to Diff 16121.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6665?vs=15988=16121

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6665/new/

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/commands.py
  tests/test-graft.t
  tests/test-issue1175.t

CHANGE DETAILS

diff --git a/tests/test-issue1175.t b/tests/test-issue1175.t
--- a/tests/test-issue1175.t
+++ b/tests/test-issue1175.t
@@ -1,3 +1,11 @@
+#testcases continueflag continuecommand
+#if continueflag
+  $ cat >> $HGRCPATH < [alias]
+  > continue = graft --continue
+  > EOF
+#endif
+
 https://bz.mercurial-scm.org/1175
 
   $ hg init
@@ -80,7 +88,7 @@
   $ hg resolve --mark b
   (no more unresolved files)
   continue: hg graft --continue
-  $ hg graft --continue
+  $ hg continue
   grafting 1:5974126fad84 "b1"
   warning: can't find ancestor for 'b' copied from 'a'!
   $ hg log -f b -T 'changeset:   {rev}:{node|short}\nsummary: {desc}\n\n'
diff --git a/tests/test-graft.t b/tests/test-graft.t
--- a/tests/test-graft.t
+++ b/tests/test-graft.t
@@ -1,4 +1,4 @@
-#testcases abortcommand abortflag
+#testcases commandmode abortflag continueflag
 
   $ cat >> $HGRCPATH < [extdiff]
@@ -13,6 +13,13 @@
   > EOF
 #endif
 
+#if continueflag
+  $ cat >> $HGRCPATH < [alias]
+  > continue = graft --continue
+  > EOF
+#endif
+
 Create a repo with some stuff in it:
 
   $ hg init a
@@ -92,9 +99,11 @@
 
   $ hg -q up -cr tip
   $ hg rm -q e
-  $ hg graft --continue
-  abort: no graft in progress
-  [255]
+  $ hg continue
+  abort: no graft in progress (continueflag !)
+  abort: no operation in progress (no-continueflag !)
+  [255]
+
   $ hg revert -r . -q e
 
 Need to specify a rev:
@@ -1697,7 +1706,13 @@
   $ hg resolve -m
   (no more unresolved files)
   continue: hg graft --continue
-  $ hg graft --continue
+
+#if commandmode
+  $ hg continue --dry-run
+  graft in progress, will be resumed
+#endif
+
+  $ hg continue
   grafting 1:80e6d2c47cfe "added b"
   grafting 2:8be98ac1a569 "added c"
 
@@ -1754,7 +1769,7 @@
   (no more unresolved files)
   continue: hg graft --continue
 
-  $ hg graft --continue
+  $ hg continue
   grafting 1:80e6d2c47cfe "added b"
   grafting 2:8be98ac1a569 "added c"
 
@@ -1803,7 +1818,7 @@
   $ hg resolve -m
   (no more unresolved files)
   continue: hg graft --continue
-  $ hg graft --continue
+  $ hg continue
   grafting 1:80e6d2c47cfe "added b"
   grafting 2:8be98ac1a569 "added c"
 
@@ -1843,7 +1858,7 @@
   (no more unresolved files)
   continue: hg graft --continue
 
-  $ hg graft --continue
+  $ hg continue
   grafting 1:80e6d2c47cfe "added b"
   grafting 2:8be98ac1a569 "added c"
 
@@ -1997,7 +2012,7 @@
 
   $ hg abort
   abort: no interrupted graft to abort (abortflag !)
-  abort: no operation in progress (abortcommand !)
+  abort: no operation in progress (no-abortflag !)
   [255]
 
 when stripping is required
@@ -2026,7 +2041,7 @@
   abort: cannot specify any other flag with '--abort'
   [255]
 
-#if abortcommand
+#if commandmode
 when in dry-run mode
   $ hg abort --dry-run
   graft in progress, will be aborted
@@ -2273,7 +2288,7 @@
   (no more unresolved files)
   continue: hg graft --continue
 
-  $ hg graft --continue
+  $ hg continue
   grafting 3:09e253b87e17 "A in file a"
   $ hg log -GT "{rev}:{node|short} {desc}\n"
   @  4:2aa9ad1006ff B in file a
@@ -2350,7 +2365,7 @@
   $ hg resolve --mark
   (no more unresolved files)
   continue: hg graft --continue
-  $ hg graft --continue
+  $ hg continue
   grafting 3:09e253b87e17 "A in file a"
   $ hg diff
   diff -r 2aa9ad1006ff a
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2629,6 +2629,7 @@
 statemod.addunfinished(
 'graft', fname='graftstate', clearable=True, stopflag=True,
 continueflag=True, abortfunc=cmdutil.hgabortgraft,
+continuefunc=cmdutil.continuegraft,
 cmdhint=_("use 'hg graft --continue' or 'hg graft --stop' to stop")
 )
 
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -3426,6 +3426,29 @@
 graftstate = statemod.cmdstate(repo, 'graftstate')
 return abortgraft(ui, repo, graftstate)
 
+def continuegraft(ui, repo):
+"""logic to resume interrupted graft using 'hg continue'"""
+with repo.wlock():
+graftstate = statemod.cmdstate(repo, 'graftstate')
+opts = {}
+statedata = {}
+cont = True
+basectx = None
+nodes, opts = continuegraftstate(repo, graftstate, opts)
+revs = [repo[node].rev() for node in nodes]
+skipped = set()
+if basectx is None:
+# check for merges
+for rev in repo.revs('%ld and merge()', revs):
+ui.warn(_('skipping ungraftable merge revision %d\n') % rev)
+skipped.add(rev)
+revs = [r for r in revs if r not in 

D6659: graft: split graft code into seperate functions

2019-08-04 Thread taapas1128 (Taapas Agrawal)
taapas1128 updated this revision to Diff 16120.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6659?vs=15987=16120

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6659/new/

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

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

CHANGE DETAILS

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2470,9 +2470,6 @@
 if not opts.get('date') and opts.get('currentdate'):
 opts['date'] = "%d %d" % dateutil.makedate()
 
-editor = cmdutil.getcommiteditor(editform='graft',
- **pycompat.strkwargs(opts))
-
 cont = False
 if opts.get('no_commit'):
 if opts.get('edit'):
@@ -2518,16 +2515,7 @@
 raise error.Abort(_("can't specify --continue and revisions"))
 # read in unfinished revisions
 if graftstate.exists():
-statedata = cmdutil.readgraftstate(repo, graftstate)
-if statedata.get('date'):
-opts['date'] = statedata['date']
-if statedata.get('user'):
-opts['user'] = statedata['user']
-if statedata.get('log'):
-opts['log'] = True
-if statedata.get('no_commit'):
-opts['no_commit'] = statedata.get('no_commit')
-nodes = statedata['nodes']
+nodes, opts = cmdutil.continuegraftstate(repo, graftstate, opts)
 revs = [repo[node].rev() for node in nodes]
 else:
 cmdutil.wrongtooltocontinue(repo, _('graft'))
@@ -2619,69 +2607,8 @@
 
 if opts.get('no_commit'):
 statedata['no_commit'] = True
-for pos, ctx in enumerate(repo.set("%ld", revs)):
-desc = '%d:%s "%s"' % (ctx.rev(), ctx,
-   ctx.description().split('\n', 1)[0])
-names = repo.nodetags(ctx.node()) + repo.nodebookmarks(ctx.node())
-if names:
-desc += ' (%s)' % ' '.join(names)
-ui.status(_('grafting %s\n') % desc)
-if opts.get('dry_run'):
-continue
-
-source = ctx.extra().get('source')
-extra = {}
-if source:
-extra['source'] = source
-extra['intermediate-source'] = ctx.hex()
-else:
-extra['source'] = ctx.hex()
-user = ctx.user()
-if opts.get('user'):
-user = opts['user']
-statedata['user'] = user
-date = ctx.date()
-if opts.get('date'):
-date = opts['date']
-statedata['date'] = date
-message = ctx.description()
-if opts.get('log'):
-message += '\n(grafted from %s)' % ctx.hex()
-statedata['log'] = True
-
-# we don't merge the first commit when continuing
-if not cont:
-# perform the graft merge with p1(rev) as 'ancestor'
-overrides = {('ui', 'forcemerge'): opts.get('tool', '')}
-base = ctx.p1() if basectx is None else basectx
-with ui.configoverride(overrides, 'graft'):
-stats = mergemod.graft(repo, ctx, base, ['local', 'graft'])
-# report any conflicts
-if stats.unresolvedcount > 0:
-# write out state for --continue
-nodes = [repo[rev].hex() for rev in revs[pos:]]
-statedata['nodes'] = nodes
-stateversion = 1
-graftstate.save(stateversion, statedata)
-hint = _("use 'hg resolve' and 'hg graft --continue'")
-raise error.Abort(
-_("unresolved conflicts, can't continue"),
-hint=hint)
-else:
-cont = False
-
-# commit if --no-commit is false
-if not opts.get('no_commit'):
-node = repo.commit(text=message, user=user, date=date, extra=extra,
-   editor=editor)
-if node is None:
-ui.warn(
-_('note: graft of %d:%s created no changes to commit\n') %
-(ctx.rev(), ctx))
-# checking that newnodes exist because old state files won't have 
it
-elif statedata.get('newnodes') is not None:
-statedata['newnodes'].append(node)
-
+
+cmdutil.finishgraft(repo, ui, basectx, revs, statedata, cont, opts)
 # remove state when we complete successfully
 if not opts.get('dry_run'):
 graftstate.delete()
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -3425,3 +3425,84 @@
 with repo.wlock():
 graftstate = statemod.cmdstate(repo, 'graftstate')
 return abortgraft(ui, repo, graftstate)
+
+def finishgraft(repo, ui, basectx, revs, statedata, cont, opts):
+"""logic to execute graft once revs are generated"""
+graftstate = 

Re: [PATCH STABLE] automation: push changes affecting .hgtags

2019-08-04 Thread Yuya Nishihara
On Sat, 03 Aug 2019 12:14:20 -0700, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc 
> # Date 1564859631 25200
> #  Sat Aug 03 12:13:51 2019 -0700
> # Branch stable
> # Node ID fcf8e489d6a667bfd2fcf066b545e52519309ee1
> # Parent  e0cf09bc35ef6d7e8554e5be98441e995c856759
> automation: push changes affecting .hgtags

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