D12609: obsolete: remove two unused constants

2022-05-05 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I'm not sure what these constants were intended for, but they have no
  users so it's time to say goodbye.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/obsolete.py

CHANGE DETAILS

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -338,8 +338,6 @@
 _fm1nodesha256size = _calcsize(_fm1nodesha256)
 _fm1fsize = _calcsize(_fm1fixed)
 _fm1parentnone = 3
-_fm1parentshift = 14
-_fm1parentmask = _fm1parentnone << _fm1parentshift
 _fm1metapair = b'BB'
 _fm1metapairsize = _calcsize(_fm1metapair)
 



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


D12608: node: manually implement Debug

2022-05-05 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I got too irritated today with the default Debug implementation of
  hg::revlog::Node while playing with a new parser. This isn't quite
  what I wanted, but it wasn't much code and it at least gives you
  output that's easy to visually compare to a node.hex()ed identifier
  from the Python side of things.
  
  Sadly, this doesn't influence the output in lldb or the VSCode
  debugger extension that uses lldb under the covers, but it at least
  means debug prints are a little more useful.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/revlog/node.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/revlog/node.rs b/rust/hg-core/src/revlog/node.rs
--- a/rust/hg-core/src/revlog/node.rs
+++ b/rust/hg-core/src/revlog/node.rs
@@ -53,12 +53,21 @@
 /// the size or return an error at runtime.
 ///
 /// [`nybbles_len`]: #method.nybbles_len
-#[derive(Copy, Clone, Debug, PartialEq, BytesCast, derive_more::From)]
+#[derive(Copy, Clone, PartialEq, BytesCast, derive_more::From)]
 #[repr(transparent)]
 pub struct Node {
 data: NodeData,
 }
 
+impl fmt::Debug for Node {
+fn fmt(, f:  fmt::Formatter<'_>) -> fmt::Result {
+let n = format!("{:x?}", self.data);
+// We're using debug_tuple because it makes the output a little
+// more compact without losing data.
+f.debug_tuple("Node").field().finish()
+}
+}
+
 /// The node value for NULL_REVISION
 pub const NULL_NODE: Node = Node {
 data: [0; NODE_BYTES_LENGTH],



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


D12603: diff: graduate merge diffs from experimental and add to tweakdefaults

2022-05-04 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I've been using this functionality for two years without incident and
  it's been outstanding. In my opinion it's time to both remove the
  experimental warning label and move this straight into tweakdefaults.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/configitems.py
  mercurial/ui.py

CHANGE DETAILS

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -81,6 +81,8 @@
 git = 1
 showfunc = 1
 word-diff = 1
+# use merge-diff functionality to make `diff` of a merge easier to understand
+merge = yes
 """
 
 samplehgrcs = {
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -774,7 +774,6 @@
 b'diff',
 b'merge',
 default=False,
-experimental=True,
 )
 coreconfigitem(
 b'email',



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


D12279: cleanup: directly use concurrent.futures instead of via pycompat

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Python 2 is gone.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/httppeer.py
  mercurial/localrepo.py
  mercurial/pycompat.py
  mercurial/wireprotov1peer.py

CHANGE DETAILS

diff --git a/mercurial/wireprotov1peer.py b/mercurial/wireprotov1peer.py
--- a/mercurial/wireprotov1peer.py
+++ b/mercurial/wireprotov1peer.py
@@ -10,6 +10,7 @@
 import sys
 import weakref
 
+from concurrent import futures
 from .i18n import _
 from .node import bin
 from .pycompat import (
@@ -88,7 +89,7 @@
 return b';'.join(cmds)
 
 
-class unsentfuture(pycompat.futures.Future):
+class unsentfuture(futures.Future):
 """A Future variation to represent an unsent command.
 
 Because we buffer commands and don't submit them immediately, calling
@@ -99,7 +100,7 @@
 
 def result(self, timeout=None):
 if self.done():
-return pycompat.futures.Future.result(self, timeout)
+return futures.Future.result(self, timeout)
 
 self._peerexecutor.sendcommands()
 
@@ -154,7 +155,7 @@
 # a batchable one and refuse to service it.
 
 def addcall():
-f = pycompat.futures.Future()
+f = futures.Future()
 self._futures.add(f)
 self._calls.append((command, args, fn, f))
 return f
@@ -194,7 +195,7 @@
 # cycle between us and futures.
 for f in self._futures:
 if isinstance(f, unsentfuture):
-f.__class__ = pycompat.futures.Future
+f.__class__ = futures.Future
 f._peerexecutor = None
 
 calls = self._calls
@@ -258,7 +259,7 @@
 # hard and it is easy to encounter race conditions, deadlocks, etc.
 # concurrent.futures already solves these problems and its thread pool
 # executor has minimal overhead. So we use it.
-self._responseexecutor = pycompat.futures.ThreadPoolExecutor(1)
+self._responseexecutor = futures.ThreadPoolExecutor(1)
 self._responsef = self._responseexecutor.submit(
 self._readbatchresponse, states, wireresults
 )
diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py
--- a/mercurial/pycompat.py
+++ b/mercurial/pycompat.py
@@ -35,8 +35,6 @@
 import SocketServer as socketserver
 import xmlrpclib
 
-from .thirdparty.concurrent import futures
-
 def future_set_exception_info(f, exc_info):
 f.set_exception_info(*exc_info)
 
@@ -45,7 +43,6 @@
 
 else:
 import builtins
-import concurrent.futures as futures
 import http.cookiejar as cookielib
 import http.client as httplib
 import pickle
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -16,6 +16,7 @@
 import time
 import weakref
 
+from concurrent import futures
 from .i18n import _
 from .node import (
 bin,
@@ -278,7 +279,7 @@
 # method on the peer and return a resolved future.
 fn = getattr(self._peer, pycompat.sysstr(command))
 
-f = pycompat.futures.Future()
+f = futures.Future()
 
 try:
 result = fn(**pycompat.strkwargs(args))
diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py
--- a/mercurial/httppeer.py
+++ b/mercurial/httppeer.py
@@ -14,6 +14,7 @@
 import socket
 import struct
 
+from concurrent import futures
 from .i18n import _
 from .pycompat import getattr
 from . import (
@@ -538,12 +539,12 @@
 raise exception
 
 
-class queuedcommandfuture(pycompat.futures.Future):
+class queuedcommandfuture(futures.Future):
 """Wraps result() on command futures to trigger submission on call."""
 
 def result(self, timeout=None):
 if self.done():
-return pycompat.futures.Future.result(self, timeout)
+return futures.Future.result(self, timeout)
 
 self._peerexecutor.sendcommands()
 



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


D12283: rust: jettison Python 2 support

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/Cargo.lock
  rust/hg-cpython/Cargo.toml
  rust/hg-cpython/src/lib.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/lib.rs b/rust/hg-cpython/src/lib.rs
--- a/rust/hg-cpython/src/lib.rs
+++ b/rust/hg-cpython/src/lib.rs
@@ -62,7 +62,7 @@
 Ok(())
 });
 
-#[cfg(not(any(feature = "python27-bin", feature = "python3-bin")))]
+#[cfg(not(feature = "python3-bin"))]
 #[test]
 #[ignore]
 fn libpython_must_be_linked_to_run_tests() {
diff --git a/rust/hg-cpython/Cargo.toml b/rust/hg-cpython/Cargo.toml
--- a/rust/hg-cpython/Cargo.toml
+++ b/rust/hg-cpython/Cargo.toml
@@ -12,12 +12,10 @@
 default = ["python3"]
 
 # Features to build an extension module:
-python27 = ["cpython/python27-sys", "cpython/extension-module-2-7"]
 python3 = ["cpython/python3-sys", "cpython/extension-module"]
 
-# Enable one of these features to build a test executable linked to libpython:
-# e.g. cargo test --no-default-features --features python27-bin
-python27-bin = ["cpython/python27-sys"]
+# Enable this feature to build a test executable linked to libpython:
+# e.g. cargo test --no-default-features --features python3-bin
 python3-bin = ["cpython/python3-sys"]
 
 [dependencies]
@@ -29,4 +27,3 @@
 env_logger = "0.7.1"
 stable_deref_trait = "1.2.0"
 vcsgraph = "0.2.0"
-
diff --git a/rust/Cargo.lock b/rust/Cargo.lock
--- a/rust/Cargo.lock
+++ b/rust/Cargo.lock
@@ -166,7 +166,6 @@
  "libc",
  "num-traits",
  "paste",
- "python27-sys",
  "python3-sys",
 ]
 
@@ -671,16 +670,6 @@
 ]
 
 [[package]]
-name = "python27-sys"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index;
-checksum = "94670354e264300dde81a5864cbb6bfc9d56ac3dcf3a278c32cb52f816f4dfd1"
-dependencies = [
- "libc",
- "regex",
-]
-
-[[package]]
 name = "python3-sys"
 version = "0.7.0"
 source = "registry+https://github.com/rust-lang/crates.io-index;



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


D12282: setup: always decode xcode version

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Not decoding was a Python 2 thing.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1663,9 +1663,7 @@
 if sys.platform == 'darwin' and os.path.exists('/usr/bin/xcodebuild'):
 version = runcmd(['/usr/bin/xcodebuild', '-version'], {})[1].splitlines()
 if version:
-version = version[0]
-if sys.version_info[0] == 3:
-version = version.decode('utf-8')
+version = version[0].decode('utf-8')
 xcode4 = version.startswith('Xcode') and StrictVersion(
 version.split()[1]
 ) >= StrictVersion('4.0')



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


D12281: setup: remove Rust support for Python 2

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1380,13 +1380,9 @@
 
 cargocmd = ['cargo', 'rustc', '--release']
 
-feature_flags = []
+feature_flags = ['python3']
 
 cargocmd.append('--no-default-features')
-if sys.version_info[0] == 2:
-feature_flags.append('python27')
-elif sys.version_info[0] == 3:
-feature_flags.append('python3')
 
 rust_features = env.get("HG_RUST_FEATURES")
 if rust_features:



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


D12280: cleanup: stop bundling concurrent.futures on Python 2

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We no longer support Python 2.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/thirdparty/concurrent/LICENSE
  mercurial/thirdparty/concurrent/__init__.py
  mercurial/thirdparty/concurrent/futures/__init__.py
  mercurial/thirdparty/concurrent/futures/_base.py
  mercurial/thirdparty/concurrent/futures/process.py
  mercurial/thirdparty/concurrent/futures/thread.py
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1249,14 +1249,6 @@
 ):
 packages.append('mercurial.templates.%s' % name)
 
-if sys.version_info[0] == 2:
-packages.extend(
-[
-'mercurial.thirdparty.concurrent',
-'mercurial.thirdparty.concurrent.futures',
-]
-)
-
 if 'HG_PY2EXE_EXTRA_INSTALL_PACKAGES' in os.environ:
 # py2exe can't cope with namespace packages very well, so we have to
 # install any hgext3rd.* extensions that we want in the final py2exe
diff --git a/mercurial/thirdparty/concurrent/futures/thread.py 
b/mercurial/thirdparty/concurrent/futures/thread.py
deleted file mode 100644
--- a/mercurial/thirdparty/concurrent/futures/thread.py
+++ /dev/null
@@ -1,162 +0,0 @@
-# Copyright 2009 Brian Quinlan. All Rights Reserved.
-# Licensed to PSF under a Contributor Agreement.
-
-"""Implements ThreadPoolExecutor."""
-
-from __future__ import absolute_import
-
-import atexit
-from . import _base
-import itertools
-import Queue as queue
-import threading
-import weakref
-import sys
-
-try:
-from multiprocessing import cpu_count
-except ImportError:
-# some platforms don't have multiprocessing
-def cpu_count():
-return None
-
-__author__ = 'Brian Quinlan (br...@sweetapp.com)'
-
-# Workers are created as daemon threads. This is done to allow the interpreter
-# to exit when there are still idle threads in a ThreadPoolExecutor's thread
-# pool (i.e. shutdown() was not called). However, allowing workers to die with
-# the interpreter has two undesirable properties:
-#   - The workers would still be running during interpretor shutdown,
-# meaning that they would fail in unpredictable ways.
-#   - The workers could be killed while evaluating a work item, which could
-# be bad if the callable being evaluated has external side-effects e.g.
-# writing to a file.
-#
-# To work around this problem, an exit handler is installed which tells the
-# workers to exit when their work queues are empty and then waits until the
-# threads finish.
-
-_threads_queues = weakref.WeakKeyDictionary()
-_shutdown = False
-
-def _python_exit():
-global _shutdown
-_shutdown = True
-items = list(_threads_queues.items()) if _threads_queues else ()
-for t, q in items:
-q.put(None)
-for t, q in items:
-t.join(sys.maxint)
-
-atexit.register(_python_exit)
-
-class _WorkItem(object):
-def __init__(self, future, fn, args, kwargs):
-self.future = future
-self.fn = fn
-self.args = args
-self.kwargs = kwargs
-
-def run(self):
-if not self.future.set_running_or_notify_cancel():
-return
-
-try:
-result = self.fn(*self.args, **self.kwargs)
-except:
-e, tb = sys.exc_info()[1:]
-self.future.set_exception_info(e, tb)
-else:
-self.future.set_result(result)
-
-def _worker(executor_reference, work_queue):
-try:
-while True:
-work_item = work_queue.get(block=True)
-if work_item is not None:
-work_item.run()
-# Delete references to object. See issue16284
-del work_item
-continue
-executor = executor_reference()
-# Exit if:
-#   - The interpreter is shutting down OR
-#   - The executor that owns the worker has been collected OR
-#   - The executor that owns the worker has been shutdown.
-if _shutdown or executor is None or executor._shutdown:
-# Notice other workers
-work_queue.put(None)
-return
-del executor
-except:
-_base.LOGGER.critical('Exception in worker', exc_info=True)
-
-
-class ThreadPoolExecutor(_base.Executor):
-
-# Used to assign unique thread names when thread_name_prefix is not 
supplied.
-_counter = itertools.count().next
-
-def __init__(self, max_workers=None, thread_name_prefix=''):
-"""Initializes a new ThreadPoolExecutor instance.
-
-Args:
-max_workers: The maximum number of threads that can be used to
-execute the given calls.
-thread_name_prefix: An optional name prefix to give our threads.
-"""
-if 

D12277: setup: remove pygit2 Python 2 logic

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1243,13 +1243,6 @@
 'hgdemandimport',
 ]
 
-# The pygit2 dependency dropped py2 support with the 1.0 release in Dec 2019.
-# Prior releases do not build at all on Windows, because Visual Studio 2008
-# doesn't understand C 11.  Older Linux releases are buggy.
-if sys.version_info[0] == 2:
-packages.remove('hgext.git')
-
-
 for name in os.listdir(os.path.join('mercurial', 'templates')):
 if name != '__pycache__' and os.path.isdir(
 os.path.join('mercurial', 'templates', name)



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


D12278: imports: allow importing futures from concurrent

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/import-checker.py

CHANGE DETAILS

diff --git a/contrib/import-checker.py b/contrib/import-checker.py
--- a/contrib/import-checker.py
+++ b/contrib/import-checker.py
@@ -24,6 +24,7 @@
 allowsymbolimports = (
 '__future__',
 'breezy',
+'concurrent',
 'hgclient',
 'mercurial',
 'mercurial.hgweb.common',



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


D12276: setup: inline now-constant list

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This varied when we supported Python 2.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -773,14 +773,10 @@
 f.write(b'/* this file is autogenerated by setup.py */\n')
 f.write(b'#define HGPYTHONLIB "%s"\n' % pythonlib)
 
-macros = None
-if sys.version_info[0] >= 3:
-macros = [('_UNICODE', None), ('UNICODE', None)]
-
 objects = self.compiler.compile(
 ['mercurial/exewrapper.c'],
 output_dir=self.build_temp,
-macros=macros,
+macros=[('_UNICODE', None), ('UNICODE', None)],
 )
 self.compiler.link_executable(
 objects, self.hgtarget, libraries=[], output_dir=self.build_temp



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


D12275: setup: unconditionally do this python 3 step

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -747,19 +747,18 @@
 
 # Also overwrite python3.dll so that hgext.git is usable.
 # TODO: also handle the MSYS flavor
-if sys.version_info[0] >= 3:
-python_x = os.path.join(
-os.path.dirname(fsdecode(buf.value)),
-"python3.dll",
+python_x = os.path.join(
+os.path.dirname(fsdecode(buf.value)),
+"python3.dll",
+)
+
+if os.path.exists(python_x):
+dest = os.path.join(
+os.path.dirname(self.hgtarget),
+os.path.basename(python_x),
 )
 
-if os.path.exists(python_x):
-dest = os.path.join(
-os.path.dirname(self.hgtarget),
-os.path.basename(python_x),
-)
-
-shutil.copy(python_x, dest)
+shutil.copy(python_x, dest)
 
 if not pythonlib:
 log.warn(



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


D12274: setup: remove Python 2 support code for determining dylib suffix

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -51,11 +51,7 @@
 print(error, file=sys.stderr)
 sys.exit(1)
 
-if sys.version_info[0] >= 3:
-DYLIB_SUFFIX = sysconfig.get_config_vars()['EXT_SUFFIX']
-else:
-# deprecated in Python 3
-DYLIB_SUFFIX = sysconfig.get_config_vars()['SO']
+DYLIB_SUFFIX = sysconfig.get_config_vars()['EXT_SUFFIX']
 
 # Solaris Python packaging brain damage
 try:



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


D12273: setup: inline os.fsdecode now that we're done with Python 2

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -741,12 +741,9 @@
 
 # Copy the pythonXY.dll next to the binary so that it runs
 # without tampering with PATH.
-fsdecode = lambda x: x
-if sys.version_info[0] >= 3:
-fsdecode = os.fsdecode
 dest = os.path.join(
 os.path.dirname(self.hgtarget),
-fsdecode(dllbasename),
+os.fsdecode(dllbasename),
 )
 
 if not os.path.exists(dest):



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


D12272: setup: inline encoding constant that is only used once

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This was variable back when we supported Python 2.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -22,8 +22,6 @@
 import sys, platform
 import sysconfig
 
-libdir_escape = 'unicode_escape'
-
 
 def sysstr(s):
 return s.decode('latin-1')
@@ -1116,7 +1114,7 @@
 )
 continue
 
-data = data.replace(b'@LIBDIR@', libdir.encode(libdir_escape))
+data = data.replace(b'@LIBDIR@', libdir.encode('unicode_escape'))
 with open(outfile, 'wb') as fp:
 fp.write(data)
 



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


D12271: setup: remove printf trampoline

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -22,7 +22,6 @@
 import sys, platform
 import sysconfig
 
-printf = eval('print')
 libdir_escape = 'unicode_escape'
 
 
@@ -51,7 +50,7 @@
 version enabling these features (likely this requires the OpenSSL version to
 be at least 1.0.1).
 """
-printf(error, file=sys.stderr)
+print(error, file=sys.stderr)
 sys.exit(1)
 
 if sys.version_info[0] >= 3:
@@ -236,8 +235,8 @@
 returncode, out, err = runcmd(cmd, self.env)
 err = filterhgerr(err)
 if err or returncode != 0:
-printf("stderr from '%s':" % (' '.join(cmd)), file=sys.stderr)
-printf(err, file=sys.stderr)
+print("stderr from '%s':" % (' '.join(cmd)), file=sys.stderr)
+print(err, file=sys.stderr)
 return b''
 return out
 
@@ -470,7 +469,7 @@
 if hgrustext != 'cpython' and hgrustext is not None:
 if hgrustext:
 msg = 'unknown HGWITHRUSTEXT value: %s' % hgrustext
-printf(msg, file=sys.stderr)
+print(msg, file=sys.stderr)
 hgrustext = None
 self.rust = hgrustext is not None
 self.no_rust = not self.rust



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


D12270: setup: remove more Python 2 support code

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I'll inline print() etc in future patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -22,23 +22,12 @@
 import sys, platform
 import sysconfig
 
-if sys.version_info[0] >= 3:
-printf = eval('print')
-libdir_escape = 'unicode_escape'
-
-def sysstr(s):
-return s.decode('latin-1')
+printf = eval('print')
+libdir_escape = 'unicode_escape'
 
-else:
-libdir_escape = 'string_escape'
 
-def printf(*args, **kwargs):
-f = kwargs.get('file', sys.stdout)
-end = kwargs.get('end', '\n')
-f.write(b' '.join(args) + end)
-
-def sysstr(s):
-return s
+def sysstr(s):
+return s.decode('latin-1')
 
 
 import ssl



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


D12269: setup: remove ssl check that only matters on 2.7

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -43,19 +43,6 @@
 
 import ssl
 
-try:
-ssl.SSLContext
-except AttributeError:
-error = """
-The `ssl` module does not have the `SSLContext` class. This indicates an old
-Python version which does not support modern security features (which were
-added to Python 2.7 as part of "PEP 466"). Please make sure you have installed
-at least Python 2.7.9 or a Python version with backports of these security
-features.
-"""
-printf(error, file=sys.stderr)
-sys.exit(1)
-
 # ssl.HAS_TLSv1* are preferred to check support but they were added in Python
 # 3.7. Prior to CPython commit 6e8cda91d92da72800d891b2fc2073ecbc134d98
 # (backported to the 3.7 branch), ssl.PROTOCOL_TLSv1_1 / ssl.PROTOCOL_TLSv1_2



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


D12268: setup: remove block that tries to help Python 2.6 users

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  It's time to move on folks.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -41,39 +41,6 @@
 return s
 
 
-# Attempt to guide users to a modern pip - this means that 2.6 users
-# should have a chance of getting a 4.2 release, and when we ratchet
-# the version requirement forward again hopefully everyone will get
-# something that works for them.
-if sys.version_info < (2, 7, 4, 'final'):
-pip_message = (
-'This may be due to an out of date pip. '
-'Make sure you have pip >= 9.0.1.'
-)
-try:
-import pip
-
-pip_version = tuple([int(x) for x in pip.__version__.split('.')[:3]])
-if pip_version < (9, 0, 1):
-pip_message = (
-'Your pip version is out of date, please install '
-'pip >= 9.0.1. pip {} detected.'.format(pip.__version__)
-)
-else:
-# pip is new enough - it must be something else
-pip_message = ''
-except Exception:
-pass
-error = """
-Mercurial does not support Python older than 2.7.4.
-Python {py} detected.
-{pip}
-""".format(
-py=sys.version_info, pip=pip_message
-)
-printf(error, file=sys.stderr)
-sys.exit(1)
-
 import ssl
 
 try:



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


D12266: setup: drop statement of support for Python before 3.5.3

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -13,15 +13,7 @@
 # bug link: https://bugs.python.org/issue25270
 supportedpy = ','.join(
 [
-'>=2.7.4',
-'!=3.0.*',
-'!=3.1.*',
-'!=3.2.*',
-'!=3.3.*',
-'!=3.4.*',
-'!=3.5.0',
-'!=3.5.1',
-'!=3.5.2',
+'>=3.5.3',
 '!=3.6.0',
 '!=3.6.1',
 ]
@@ -37,7 +29,6 @@
 def sysstr(s):
 return s.decode('latin-1')
 
-
 else:
 libdir_escape = 'string_escape'
 



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


D12186: sparse: add timing block for parsing sparse configs

2022-02-15 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This was showing up in an operation I was doing today, and I'd like to
  be able to get trace spans for it instead of just profiler samples.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/sparse.py

CHANGE DETAILS

diff --git a/mercurial/sparse.py b/mercurial/sparse.py
--- a/mercurial/sparse.py
+++ b/mercurial/sparse.py
@@ -38,63 +38,66 @@
 
 Returns a tuple of includes, excludes, and profiles.
 """
-includes = set()
-excludes = set()
-profiles = set()
-current = None
-havesection = False
+with util.timedcm(
+'sparse.parseconfig(ui, %d bytes, action=%s)', len(raw), action
+):
+includes = set()
+excludes = set()
+profiles = set()
+current = None
+havesection = False
 
-for line in raw.split(b'\n'):
-line = line.strip()
-if not line or line.startswith(b'#'):
-# empty or comment line, skip
-continue
-elif line.startswith(b'%include '):
-line = line[9:].strip()
-if line:
-profiles.add(line)
-elif line == b'[include]':
-if havesection and current != includes:
-# TODO pass filename into this API so we can report it.
-raise error.Abort(
-_(
-b'%(action)s config cannot have includes '
-b'after excludes'
+for line in raw.split(b'\n'):
+line = line.strip()
+if not line or line.startswith(b'#'):
+# empty or comment line, skip
+continue
+elif line.startswith(b'%include '):
+line = line[9:].strip()
+if line:
+profiles.add(line)
+elif line == b'[include]':
+if havesection and current != includes:
+# TODO pass filename into this API so we can report it.
+raise error.Abort(
+_(
+b'%(action)s config cannot have includes '
+b'after excludes'
+)
+% {b'action': action}
 )
-% {b'action': action}
-)
-havesection = True
-current = includes
-continue
-elif line == b'[exclude]':
-havesection = True
-current = excludes
-elif line:
-if current is None:
-raise error.Abort(
-_(
-b'%(action)s config entry outside of '
-b'section: %(line)s'
+havesection = True
+current = includes
+continue
+elif line == b'[exclude]':
+havesection = True
+current = excludes
+elif line:
+if current is None:
+raise error.Abort(
+_(
+b'%(action)s config entry outside of '
+b'section: %(line)s'
+)
+% {b'action': action, b'line': line},
+hint=_(
+b'add an [include] or [exclude] line '
+b'to declare the entry type'
+),
 )
-% {b'action': action, b'line': line},
-hint=_(
-b'add an [include] or [exclude] line '
-b'to declare the entry type'
-),
-)
 
-if line.strip().startswith(b'/'):
-ui.warn(
-_(
-b'warning: %(action)s profile cannot use'
-b' paths starting with /, ignoring %(line)s\n'
+if line.strip().startswith(b'/'):
+ui.warn(
+_(
+b'warning: %(action)s profile cannot use'
+b' paths starting with /, ignoring %(line)s\n'
+)
+% {b'action': action, b'line': line}
 )
-% {b'action': action, b'line': line}
-)
-continue
-current.add(line)
+continue
+current.add(line)
 
-return includes, excludes, profiles
+return includes, excludes, profiles
 
 
 # Exists as separate function to facilitate monkeypatching.



To: durin42, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___

D12185: narrowspec: add timing block for validating narrowspec

2022-02-15 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This was showing up in an operation I was doing today, and I'd like to
  be able to get trace spans for it instead of just profiler samples.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/narrowspec.py

CHANGE DETAILS

diff --git a/mercurial/narrowspec.py b/mercurial/narrowspec.py
--- a/mercurial/narrowspec.py
+++ b/mercurial/narrowspec.py
@@ -109,23 +109,24 @@
 and patterns that are loaded from sources that use the internal,
 prefixed pattern representation (but can't necessarily be fully trusted).
 """
-if not isinstance(pats, set):
-raise error.ProgrammingError(
-b'narrow patterns should be a set; got %r' % pats
-)
+with util.timedcm('narrowspec.validatepatterns(pats size=%d)', len(pats)):
+if not isinstance(pats, set):
+raise error.ProgrammingError(
+b'narrow patterns should be a set; got %r' % pats
+)
 
-for pat in pats:
-if not pat.startswith(VALID_PREFIXES):
-# Use a Mercurial exception because this can happen due to user
-# bugs (e.g. manually updating spec file).
-raise error.Abort(
-_(b'invalid prefix on narrow pattern: %s') % pat,
-hint=_(
-b'narrow patterns must begin with one of '
-b'the following: %s'
+for pat in pats:
+if not pat.startswith(VALID_PREFIXES):
+# Use a Mercurial exception because this can happen due to user
+# bugs (e.g. manually updating spec file).
+raise error.Abort(
+_(b'invalid prefix on narrow pattern: %s') % pat,
+hint=_(
+b'narrow patterns must begin with one of '
+b'the following: %s'
+)
+% b', '.join(VALID_PREFIXES),
 )
-% b', '.join(VALID_PREFIXES),
-)
 
 
 def format(includes, excludes):



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


D11958: git: add opener attribute to gitstore

2022-01-05 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/git/__init__.py

CHANGE DETAILS

diff --git a/hgext/git/__init__.py b/hgext/git/__init__.py
--- a/hgext/git/__init__.py
+++ b/hgext/git/__init__.py
@@ -51,6 +51,7 @@
 class gitstore(object):  # store.basicstore):
 def __init__(self, path, vfstype):
 self.vfs = vfstype(path)
+self.opener = self.vfs
 self.path = self.vfs.base
 self.createmode = store._calcmode(self.vfs)
 # above lines should go away in favor of:



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


D11233: dirstate: fix typo in docstring

2021-07-29 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Spotted while repairing git extension tests.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -599,7 +599,7 @@
 
 This function must be called within a `dirstate.parentchange` context.
 
-note: the API is at an early stage and we might need to ajust it
+note: the API is at an early stage and we might need to adjust it
 depending of what information ends up being relevant and useful to
 other processing.
 """



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


D11234: git: restore basic functionality (issue6545)

2021-07-29 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  It looks like a big refactor happened on dirstate, and the git extension was
  just ignored.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/git/dirstate.py

CHANGE DETAILS

diff --git a/hgext/git/dirstate.py b/hgext/git/dirstate.py
--- a/hgext/git/dirstate.py
+++ b/hgext/git/dirstate.py
@@ -74,6 +74,8 @@
 self._root = os.path.dirname(root)
 self.git = gitrepo
 self._plchangecallbacks = {}
+# TODO: context.poststatusfixup is bad and uses this attribute
+self._dirty = False
 
 def p1(self):
 try:
@@ -255,12 +257,12 @@
 if match(p):
 yield p
 
-def normal(self, f, parentfiledata=None):
+def set_clean(self, f, parentfiledata=None):
 """Mark a file normal and clean."""
 # TODO: for now we just let libgit2 re-stat the file. We can
 # clearly do better.
 
-def normallookup(self, f):
+def set_possibly_dirty(self, f):
 """Mark a file normal, but possibly dirty."""
 # TODO: for now we just let libgit2 re-stat the file. We can
 # clearly do better.
@@ -296,6 +298,16 @@
 # TODO: figure out a strategy for saving index backups.
 pass
 
+def set_tracked(self, f):
+uf = pycompat.fsdecode(f)
+if uf in self.git.index:
+return False
+index = self.git.index
+index.read()
+index.add(uf)
+index.write()
+return True
+
 def add(self, f):
 index = self.git.index
 index.read()
@@ -310,6 +322,16 @@
 index.remove(fs)
 index.write()
 
+def set_untracked(self, f):
+index = self.git.index
+index.read()
+fs = pycompat.fsdecode(f)
+if fs in index:
+index.remove(fs)
+index.write()
+return True
+return False
+
 def remove(self, f):
 index = self.git.index
 index.read()
@@ -324,6 +346,10 @@
 # TODO
 pass
 
+def update_file(self, *args, **kwargs):
+# TODO
+pass
+
 @contextlib.contextmanager
 def parentchange(self):
 # TODO: track this maybe?



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


D11232: rewriteutil: fix crash when a rewritten message references f{6, 64}

2021-07-29 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Without this, the rewriteutil logic thinks it's found a reference to the wdir
  pseudo-revision, and then tries to look it up and rewrite it. Stop it from
  doing that.
  
  Amusingly, I had trouble working with this changeset when I didn't
  describe the defect above using a regular expression, because it would
  trigger the bug in my installed version of hg.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/rewriteutil.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -971,9 +971,9 @@
   $ hg ci -m 'this will change hash'
   created new head
   $ echo changed >> update_hash_refs
-  $ hg ci -m "this starts as the child of `hg log -r . -T'{node|short}'` but 
not 506e2454484b"
+  $ hg ci -m "this starts as the child of `hg log -r . -T'{node|short}'` but 
not 506e2454484b. Also, "
   $ hg tglog
-  @  5: becd28036887 'this starts as the child of 98789aa60148 but not 
506e2454484b'
+  @  5: a8b42cbbde83 'this starts as the child of 98789aa60148 but not 
506e2454484b. Also, '
   |
   o  4: 98789aa60148 'this will change hash'
   |
@@ -987,10 +987,10 @@
   
   $ hg rebase -r '.^::' -d 3
   rebasing 4:98789aa60148 "this will change hash"
-  rebasing 5:becd28036887 tip "this starts as the child of 98789aa60148 but 
not 506e2454484b"
-  saved backup bundle to 
$TESTTMP/keep_merge/.hg/strip-backup/98789aa60148-72ec40bd-rebase.hg
+  rebasing 5:a8b42cbbde83 tip "this starts as the child of 98789aa60148 but 
not 506e2454484b. Also, "
+  saved backup bundle to 
$TESTTMP/keep_merge/.hg/strip-backup/98789aa60148-da3f4c2c-rebase.hg
   $ hg tglog
-  @  5: a445b8426f4b 'this starts as the child of c16c25696fe7 but not 
506e2454484b'
+  @  5: 0fd2912e6cc1 'this starts as the child of c16c25696fe7 but not 
506e2454484b. Also, '
   |
   o  4: c16c25696fe7 'this will change hash'
   |
diff --git a/mercurial/rewriteutil.py b/mercurial/rewriteutil.py
--- a/mercurial/rewriteutil.py
+++ b/mercurial/rewriteutil.py
@@ -207,7 +207,12 @@
 hashes = re.findall(NODE_RE, commitmsg)
 unfi = repo.unfiltered()
 for h in hashes:
-fullnode = scmutil.resolvehexnodeidprefix(unfi, h)
+try:
+fullnode = scmutil.resolvehexnodeidprefix(unfi, h)
+except error.WdirUnsupported:
+# Someone has an f... in a commit message we're
+# rewriting. Don't try rewriting that.
+continue
 if fullnode is None:
 continue
 ctx = unfi[fullnode]



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


D11231: tests: add explicit coverage for update_hash_refs from rewriteutil

2021-07-29 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I couldn't find any evidence this is covered by tests in core (but there's a
  good chance I missed it). We've seen a cute bug in that code, but first
  let's just cover the cases that work correctly.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -963,6 +963,46 @@
   o  0: d20a80d4def3 'base'
   
 
+Test that update_hash_refs works.
+  $ hg co 0
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo update_hash_refs > update_hash_refs
+  $ hg add update_hash_refs
+  $ hg ci -m 'this will change hash'
+  created new head
+  $ echo changed >> update_hash_refs
+  $ hg ci -m "this starts as the child of `hg log -r . -T'{node|short}'` but 
not 506e2454484b"
+  $ hg tglog
+  @  5: becd28036887 'this starts as the child of 98789aa60148 but not 
506e2454484b'
+  |
+  o  4: 98789aa60148 'this will change hash'
+  |
+  | o3: 506e2454484b 'merge'
+  | |\
+  +---o  2: 531f80391e4a 'c'
+  | |
+  | o  1: 6f252845ea45 'a'
+  |/
+  o  0: d20a80d4def3 'base'
+  
+  $ hg rebase -r '.^::' -d 3
+  rebasing 4:98789aa60148 "this will change hash"
+  rebasing 5:becd28036887 tip "this starts as the child of 98789aa60148 but 
not 506e2454484b"
+  saved backup bundle to 
$TESTTMP/keep_merge/.hg/strip-backup/98789aa60148-72ec40bd-rebase.hg
+  $ hg tglog
+  @  5: a445b8426f4b 'this starts as the child of c16c25696fe7 but not 
506e2454484b'
+  |
+  o  4: c16c25696fe7 'this will change hash'
+  |
+  o3: 506e2454484b 'merge'
+  |\
+  | o  2: 531f80391e4a 'c'
+  | |
+  o |  1: 6f252845ea45 'a'
+  |/
+  o  0: d20a80d4def3 'base'
+  
+
   $ cd ..
 
 Test (virtual) working directory without changes, created by merge conflict



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


D11092: pyoxidizer: add hooks to inject extra python packages and install files

2021-07-14 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We need this type of hook to inject our internal extension and resource files
  at Google. Presumably this could be useful to others, so instead of trying to
  carry an internal patch we've done this in a modular way that should be of
  value upstream.
  
  I'm extremely puzzled by the behavior of glob() on Windows, and I'll
  be filing at least one (probably two) bugs upstream about it.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hgcli/pyoxidizer.bzl

CHANGE DETAILS

diff --git a/rust/hgcli/pyoxidizer.bzl b/rust/hgcli/pyoxidizer.bzl
--- a/rust/hgcli/pyoxidizer.bzl
+++ b/rust/hgcli/pyoxidizer.bzl
@@ -103,6 +103,12 @@
 exe.add_python_resources(
 exe.pip_install(["-r", ROOT + 
"/contrib/packaging/requirements-windows-py3.txt"]),
 )
+extra_packages = VARS.get("extra_py_packages", "")
+if extra_packages:
+for extra in extra_packages.split(","):
+extra_src, pkgs = extra.split("=")
+pkgs = pkgs.split(":")
+exe.add_python_resources(exe.read_package_root(extra_src, pkgs))
 
 return exe
 
@@ -144,6 +150,17 @@
 print("copying %s to %s" % (path, new_path))
 manifest.add_file(manifest.get_file(path), path = new_path)
 
+extra_install_files = VARS.get("extra_install_files", "")
+if extra_install_files:
+for extra in extra_install_files.split(","):
+print("adding extra files from %s" % extra)
+# TODO: I expected a ** glob to work, but it didn't.
+#
+# TODO: I know this has forward-slash paths. As far as I can tell,
+# backslashes don't ever match glob() expansions in 
+# tugger-starlark, even on Windows.
+manifest.add_manifest(glob(include=[extra + "/*/*"], 
strip_prefix=extra+"/"))
+
 # We also install a handful of additional files.
 EXTRA_CONTRIB_FILES = [
 "bash_completion",



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


D11093: packaging: add command line flag to add extra vars to pyoxidizer

2021-07-14 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This felt simpler than the previous incarnation of injecting
  content into the WiX build. I decided the easiest way to pass
  an arbitrary map into the process was some json - I may regret this,
  but time will tell on that.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/packaging/hgpackaging/cli.py
  contrib/packaging/hgpackaging/wix.py

CHANGE DETAILS

diff --git a/contrib/packaging/hgpackaging/wix.py 
b/contrib/packaging/hgpackaging/wix.py
--- a/contrib/packaging/hgpackaging/wix.py
+++ b/contrib/packaging/hgpackaging/wix.py
@@ -8,6 +8,7 @@
 # no-check-code because Python 3 native.
 
 import collections
+import json
 import os
 import pathlib
 import re
@@ -386,6 +387,7 @@
 extra_wxs: typing.Optional[typing.Dict[str, str]] = None,
 extra_features: typing.Optional[typing.List[str]] = None,
 signing_info: typing.Optional[typing.Dict[str, str]] = None,
+extra_pyoxidizer_vars=None,
 ):
 """Build a WiX MSI installer using PyOxidizer."""
 hg_build_dir = source_dir / "build"
@@ -418,6 +420,9 @@
 if signing_info["timestamp_url"]:
 build_vars["TIME_STAMP_SERVER_URL"] = signing_info["timestamp_url"]
 
+if extra_pyoxidizer_vars:
+build_vars.update(json.loads(extra_pyoxidizer_vars))
+
 if extra_wxs:
 raise Exception(
 "support for extra .wxs files has been temporarily dropped"
diff --git a/contrib/packaging/hgpackaging/cli.py 
b/contrib/packaging/hgpackaging/cli.py
--- a/contrib/packaging/hgpackaging/cli.py
+++ b/contrib/packaging/hgpackaging/cli.py
@@ -64,6 +64,7 @@
 extra_packages_script=None,
 extra_wxs=None,
 extra_features=None,
+extra_pyoxidizer_vars=None,
 ):
 if not pyoxidizer_target and not python:
 raise Exception("--python required unless building with PyOxidizer")
@@ -105,7 +106,7 @@
 "timestamp_url": sign_timestamp_url,
 }
 
-fn(**kwargs)
+fn(**kwargs, extra_pyoxidizer_vars=extra_pyoxidizer_vars)
 
 
 def get_parser():
@@ -168,6 +169,12 @@
 "in the installer from the extra wxs files"
 ),
 )
+
+sp.add_argument(
+"--extra-pyoxidizer-vars",
+help="json map of extra variables to pass to pyoxidizer",
+)
+
 sp.set_defaults(func=build_wix)
 
 return parser



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


D11030: parsers: move DirstateItem to attr.s

2021-07-08 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/pure/parsers.py

CHANGE DETAILS

diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
--- a/mercurial/pure/parsers.py
+++ b/mercurial/pure/parsers.py
@@ -14,6 +14,7 @@
 nullrev,
 sha1nodeconstants,
 )
+from ..thirdparty import attr
 from .. import (
 error,
 pycompat,
@@ -43,6 +44,7 @@
 AMBIGUOUS_TIME = -1
 
 
+@attr.s
 class DirstateItem(object):
 """represent a dirstate entry
 
@@ -54,13 +56,10 @@
 - mtime,
 """
 
-__slot__ = ('_state', '_mode', '_size', '_mtime')
-
-def __init__(self, state, mode, size, mtime):
-self._state = state
-self._mode = mode
-self._size = size
-self._mtime = mtime
+_state = attr.ib()
+_mode = attr.ib()
+_size = attr.ib()
+_mtime = attr.ib()
 
 def __getitem__(self, idx):
 if idx == 0 or idx == -4:



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


D11006: remotefilelog: stop using RuntimeError for control flow

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

REVISION SUMMARY
  We introduce a new exception to handle the various failure categories,
  rather than relying on RuntimeError.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/remotefilelog/basestore.py
  hgext/remotefilelog/shallowutil.py
  tests/test-remotefilelog-corrupt-cache.t

CHANGE DETAILS

diff --git a/tests/test-remotefilelog-corrupt-cache.t 
b/tests/test-remotefilelog-corrupt-cache.t
--- a/tests/test-remotefilelog-corrupt-cache.t
+++ b/tests/test-remotefilelog-corrupt-cache.t
@@ -38,7 +38,7 @@
   $ chmod u+w 
$CACHEDIR/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/1406e74118627694268417491f018a4a883152f0
   $ echo x > 
$CACHEDIR/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/1406e74118627694268417491f018a4a883152f0
   $ hg up tip 2>&1 | egrep "^[^ ].*unexpected remotefilelog"
-  RuntimeError: unexpected remotefilelog header: illegal format
+  hgext.remotefilelog.shallowutil.BadRemotefilelogHeader: unexpected 
remotefilelog header: illegal format
 
 Verify detection and remediation when remotefilelog.validatecachelog is set
 
diff --git a/hgext/remotefilelog/shallowutil.py 
b/hgext/remotefilelog/shallowutil.py
--- a/hgext/remotefilelog/shallowutil.py
+++ b/hgext/remotefilelog/shallowutil.py
@@ -233,6 +233,10 @@
 return x
 
 
+class BadRemotefilelogHeader(error.StorageError):
+"""Exception raised when parsing a remotefilelog blob header fails."""
+
+
 def parsesizeflags(raw):
 """given a remotefilelog blob, return (headersize, rawtextsize, flags)
 
@@ -253,16 +257,20 @@
 elif s.startswith(constants.METAKEYFLAG):
 flags = int(s[len(constants.METAKEYFLAG) :])
 else:
-raise RuntimeError(
+raise BadRemotefilelogHeader(
 b'unsupported remotefilelog header: %s' % header
 )
 else:
 # v0, str(int(size)) is the header
 size = int(header)
 except ValueError:
-raise RuntimeError("unexpected remotefilelog header: illegal format")
+raise BadRemotefilelogHeader(
+"unexpected remotefilelog header: illegal format"
+)
 if size is None:
-raise RuntimeError("unexpected remotefilelog header: no size found")
+raise BadRemotefilelogHeader(
+"unexpected remotefilelog header: no size found"
+)
 return index + 1, size, flags
 
 
diff --git a/hgext/remotefilelog/basestore.py b/hgext/remotefilelog/basestore.py
--- a/hgext/remotefilelog/basestore.py
+++ b/hgext/remotefilelog/basestore.py
@@ -308,7 +308,7 @@
 # Content matches the intended path
 return True
 return False
-except (ValueError, RuntimeError):
+except (ValueError, shallowutil.BadRemotefilelogHeader):
 pass
 
 return False



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


D11008: shallowutil: dedent code after the previous change

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

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/remotefilelog/shallowutil.py

CHANGE DETAILS

diff --git a/hgext/remotefilelog/shallowutil.py 
b/hgext/remotefilelog/shallowutil.py
--- a/hgext/remotefilelog/shallowutil.py
+++ b/hgext/remotefilelog/shallowutil.py
@@ -251,23 +251,22 @@
 raise BadRemotefilelogHeader(
 "unexpected remotefilelog header: illegal format"
 )
-if True:
-header = raw[:index]
-if header.startswith(b'v'):
-# v1 and above, header starts with 'v'
-if header.startswith(b'v1\n'):
-for s in header.split(b'\n'):
-if s.startswith(constants.METAKEYSIZE):
-size = int(s[len(constants.METAKEYSIZE) :])
-elif s.startswith(constants.METAKEYFLAG):
-flags = int(s[len(constants.METAKEYFLAG) :])
-else:
-raise BadRemotefilelogHeader(
-b'unsupported remotefilelog header: %s' % header
-)
+header = raw[:index]
+if header.startswith(b'v'):
+# v1 and above, header starts with 'v'
+if header.startswith(b'v1\n'):
+for s in header.split(b'\n'):
+if s.startswith(constants.METAKEYSIZE):
+size = int(s[len(constants.METAKEYSIZE) :])
+elif s.startswith(constants.METAKEYFLAG):
+flags = int(s[len(constants.METAKEYFLAG) :])
 else:
-# v0, str(int(size)) is the header
-size = int(header)
+raise BadRemotefilelogHeader(
+b'unsupported remotefilelog header: %s' % header
+)
+else:
+# v0, str(int(size)) is the header
+size = int(header)
 if size is None:
 raise BadRemotefilelogHeader(
 "unexpected remotefilelog header: no size found"



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


D11007: shallowutil: narrow scope of try/except block

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

REVISION SUMMARY
  This will make this code easier to understand in the future.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/remotefilelog/shallowutil.py

CHANGE DETAILS

diff --git a/hgext/remotefilelog/shallowutil.py 
b/hgext/remotefilelog/shallowutil.py
--- a/hgext/remotefilelog/shallowutil.py
+++ b/hgext/remotefilelog/shallowutil.py
@@ -247,6 +247,11 @@
 size = None
 try:
 index = raw.index(b'\0')
+except ValueError:
+raise BadRemotefilelogHeader(
+"unexpected remotefilelog header: illegal format"
+)
+if True:
 header = raw[:index]
 if header.startswith(b'v'):
 # v1 and above, header starts with 'v'
@@ -263,10 +268,6 @@
 else:
 # v0, str(int(size)) is the header
 size = int(header)
-except ValueError:
-raise BadRemotefilelogHeader(
-"unexpected remotefilelog header: illegal format"
-)
 if size is None:
 raise BadRemotefilelogHeader(
 "unexpected remotefilelog header: no size found"



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


D11005: remotefilelog: tweak corrupt cache test to grep more flexibly

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

REVISION SUMMARY
  I'm about to fix the abuse of RuntimeError here, which breaks the test
  if I don't do this.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-remotefilelog-corrupt-cache.t

CHANGE DETAILS

diff --git a/tests/test-remotefilelog-corrupt-cache.t 
b/tests/test-remotefilelog-corrupt-cache.t
--- a/tests/test-remotefilelog-corrupt-cache.t
+++ b/tests/test-remotefilelog-corrupt-cache.t
@@ -37,7 +37,7 @@
   > EOF
   $ chmod u+w 
$CACHEDIR/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/1406e74118627694268417491f018a4a883152f0
   $ echo x > 
$CACHEDIR/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/1406e74118627694268417491f018a4a883152f0
-  $ hg up tip 2>&1 | egrep "^RuntimeError"
+  $ hg up tip 2>&1 | egrep "^[^ ].*unexpected remotefilelog"
   RuntimeError: unexpected remotefilelog header: illegal format
 
 Verify detection and remediation when remotefilelog.validatecachelog is set



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


D10777: fuzz: add hg to sys.path when constructing mpatch corpus

2021-05-27 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/fuzz/mpatch_corpus.py

CHANGE DETAILS

diff --git a/contrib/fuzz/mpatch_corpus.py b/contrib/fuzz/mpatch_corpus.py
--- a/contrib/fuzz/mpatch_corpus.py
+++ b/contrib/fuzz/mpatch_corpus.py
@@ -1,10 +1,15 @@
 from __future__ import absolute_import, print_function
 
 import argparse
+import os
 import struct
 import sys
 import zipfile
 
+# Add ../.. to sys.path as an absolute path so we can import hg modules
+hgloc = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
+sys.path[0:0] = [hgloc]
+
 from mercurial import (
 hg,
 ui as uimod,



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


D10733: hghave: make error output easier to diagnose

2021-05-18 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I had a typo that meant the new bash check was throwing an exception
  (due to a missing argument), but it was very hard to diagnose without
  this change.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/hghave.py

CHANGE DETAILS

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -104,8 +104,8 @@
 check, desc = checks[feature]
 try:
 available = check()
-except Exception:
-result['error'].append('hghave check failed: %s' % feature)
+except Exception as e:
+result['error'].append('hghave check %s failed: %r' % (feature, e))
 continue
 
 if not negate and not available:



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


D10732: tests: add req on bash for test-transaction-rollback-on-sigpipe (issue6429)

2021-05-18 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I think we could work around this by rewriting the helper scripts in
  Python, but I don't want to deal with that now and this should prevent
  failures due to a lack of bash.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/hghave.py
  tests/test-transaction-rollback-on-sigpipe.t

CHANGE DETAILS

diff --git a/tests/test-transaction-rollback-on-sigpipe.t 
b/tests/test-transaction-rollback-on-sigpipe.t
--- a/tests/test-transaction-rollback-on-sigpipe.t
+++ b/tests/test-transaction-rollback-on-sigpipe.t
@@ -1,3 +1,4 @@
+#require bash
 Test that, when an hg push is interrupted and the remote side recieves SIGPIPE,
 the remote hg is able to successfully roll back the transaction.
 
diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -1121,3 +1121,8 @@
 return True
 except ImportError:
 return False
+
+
+@check("bash", "bash shell")
+def has_bash():
+return matchoutput("bash -c 'echo hi'", b'^hi$')



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


D6594: [ABANDONED] RFC dirstatemap

2021-05-12 Thread durin42 (Augie Fackler)
Herald added a subscriber: mercurial-patches.
durin42 added a comment.
durin42 added subscribers: muxator, gracinet.


  (+ infra list, some folks that I think volunteered in the past)

REPOSITORY
  rHG Mercurial

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

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

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


D10669: debugcommands: fix some plural-agreements I noticed

2021-05-04 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/debugcommands.py

CHANGE DETAILS

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -4086,7 +4086,7 @@
 should complete almost instantaneously and the chances of a consumer being
 unable to access the repository should be low.
 
-By default, all revlog will be upgraded. You can restrict this using flag
+By default, all revlogs will be upgraded. You can restrict this using flags
 such as `--manifest`:
 
   * `--manifest`: only optimize the manifest



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


D10185: black: merge config into main pyproject.toml now that we have it

2021-03-12 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This means that naive contributors who just run `black` on a source file
  will get reasonable behavior as long as they have a recent black. Yay!
  
  This was previously D9834  but was 
rolled back due to test
  failures. nbjoerg thinks it's time to try again, so let's give it a
  shot.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  black.toml
  contrib/examples/fix.hgrc
  pyproject.toml
  tests/test-check-code.t
  tests/test-check-format.t

CHANGE DETAILS

diff --git a/tests/test-check-format.t b/tests/test-check-format.t
--- a/tests/test-check-format.t
+++ b/tests/test-check-format.t
@@ -1,5 +1,5 @@
 #require black test-repo
 
   $ cd $RUNTESTDIR/..
-  $ black --config=black.toml --check --diff `hg files 'set:(**.py + 
grep("^#!.*python")) - mercurial/thirdparty/**'`
+  $ black --check --diff `hg files 'set:(**.py + grep("^#!.*python")) - 
mercurial/thirdparty/**'`
 
diff --git a/tests/test-check-code.t b/tests/test-check-code.t
--- a/tests/test-check-code.t
+++ b/tests/test-check-code.t
@@ -66,7 +66,6 @@
   COPYING
   Makefile
   README.rst
-  black.toml
   hg
   hgeditor
   hgweb.cgi
diff --git a/pyproject.toml b/pyproject.toml
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,3 +1,18 @@
 [build-system]
 requires = ["setuptools", "wheel"]
 build-backend = "setuptools.build_meta"
+
+[tool.black]
+line-length = 80
+exclude = '''
+build/
+| wheelhouse/
+| dist/
+| packages/
+| \.hg/
+| \.mypy_cache/
+| \.venv/
+| mercurial/thirdparty/
+'''
+skip-string-normalization = true
+quiet = true
diff --git a/contrib/examples/fix.hgrc b/contrib/examples/fix.hgrc
--- a/contrib/examples/fix.hgrc
+++ b/contrib/examples/fix.hgrc
@@ -5,7 +5,7 @@
 rustfmt:command = rustfmt +nightly
 rustfmt:pattern = set:"**.rs" - "mercurial/thirdparty/**"
 
-black:command = black --config=black.toml -
+black:command = black
 black:pattern = set:**.py - mercurial/thirdparty/**
 
 # Mercurial doesn't have any Go code, but if we did this is how we
diff --git a/black.toml b/black.toml
deleted file mode 100644
--- a/black.toml
+++ /dev/null
@@ -1,14 +0,0 @@
-[tool.black]
-line-length = 80
-exclude = '''
-build/
-| wheelhouse/
-| dist/
-| packages/
-| \.hg/
-| \.mypy_cache/
-| \.venv/
-| mercurial/thirdparty/
-'''
-skip-string-normalization = true
-quiet = true



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


D10184: pyproject: add config file

2021-03-12 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This will tell pip et al to call our setup.py for the majority of
  packaging concerns, but also gives us a place to put standard config
  stuff like black.
  
  This was previously D9833 , but was 
rolled back due to test
  breakage. nbjoerg thinks that breakage is now resolved, so we're
  trying again.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  pyproject.toml
  tests/test-check-code.t

CHANGE DETAILS

diff --git a/tests/test-check-code.t b/tests/test-check-code.t
--- a/tests/test-check-code.t
+++ b/tests/test-check-code.t
@@ -70,6 +70,7 @@
   hg
   hgeditor
   hgweb.cgi
+  pyproject.toml
   rustfmt.toml
   setup.py
 
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,3 @@
+[build-system]
+requires = ["setuptools", "wheel"]
+build-backend = "setuptools.build_meta"



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


D10066: fuzz: if the caller of our makefile sets CC and CXX, trust them

2021-02-24 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This should fix the broken fuzzing build, because we've been
  explicitly using clang++ but are now being given a CXX=afl++, which
  does extra stuff.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/fuzz/Makefile

CHANGE DETAILS

diff --git a/contrib/fuzz/Makefile b/contrib/fuzz/Makefile
--- a/contrib/fuzz/Makefile
+++ b/contrib/fuzz/Makefile
@@ -1,5 +1,5 @@
-CC = clang
-CXX = clang++
+CC ?= clang
+CXX ?= clang++
 
 # By default, use our own standalone_fuzz_target_runner.
 # This runner does no fuzzing, but simply executes the inputs



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


D9944: relnotes: add entry for `hg diff --merge -c`

2021-02-01 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  relnotes/next

CHANGE DETAILS

diff --git a/relnotes/next b/relnotes/next
--- a/relnotes/next
+++ b/relnotes/next
@@ -5,6 +5,10 @@
  * The `rev-branch-cache` is now updated incrementally whenever changesets
are added.
 
+ * `hg diff` now takes an experimental `--merge` flag which causes `hg
+diff --change` to show the changes relative to an automerge for
+merge changesets. This makes it easier to detect and review manual
+changes performed in merge changesets.
 
 == New Experimental Features ==
 



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


D9939: diff: suppress `merging foo` output lines when performing a merge diff

2021-02-01 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-diff-change.t

CHANGE DETAILS

diff --git a/tests/test-diff-change.t b/tests/test-diff-change.t
--- a/tests/test-diff-change.t
+++ b/tests/test-diff-change.t
@@ -197,7 +197,6 @@
 merge diff should show only manual edits to a merge:
 
   $ hg diff --merge -c 6
-  merging file.txt
 (no diff output is expected here)
 
 Construct an "evil merge" that does something other than just the merge.
@@ -228,7 +227,6 @@
 up, making it easy to identify changes someone is otherwise trying to sneak
 into a merge.
   $ hg diff --merge -c 7
-  merging file.txt
   diff -r 8ad85e839ba7 file.txt
   --- a/file.txt   Thu Jan 01 00:00:00 1970 +
   +++ b/file.txt   Thu Jan 01 00:00:00 1970 +
@@ -277,7 +275,6 @@
   +this file is new in p2 of the merge
 With --merge, it's a diff against the conflicted content.
   $ hg diff --merge -c 11
-  merging file.txt
   diff -r 5010caab09f6 file.txt
   --- a/file.txt   Thu Jan 01 00:00:00 1970 +
   +++ b/file.txt   Thu Jan 01 00:00:00 1970 +
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2567,7 +2567,7 @@
 pctx1 = mctx.p1()
 pctx2 = mctx.p2()
 wctx = contextmod.overlayworkingctx(repo)
-wctx.setbase(ctx1)
+wctx.setbase(pctx1)
 with ui.configoverride(
 {
 (
@@ -2577,7 +2577,9 @@
 },
 b'diff --merge',
 ):
+repo.ui.pushbuffer()
 stats = mergemod.merge(pctx2, wc=wctx)
+repo.ui.popbuffer()
 ctx1 = wctx
 ctx2 = mctx
 else:



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


D9908: context: add missing manifest invalidation after write in overlayworkingctx

2021-01-29 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This was breaking my merge-diff logic that will be in the next patch.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -2597,6 +2597,7 @@
 b'flags': flags,
 b'copied': copied,
 }
+util.clearcachedproperty(self, b'_manifest')
 
 def filectx(self, path, filelog=None):
 return overlayworkingfilectx(



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


D9855: histedit: rip out mysterious catch-all ignore curses.error handler

2021-01-22 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I have no idea why this was here, and ripping it out doesn't obviously
  break anything for me (tests all pass, I can poke around chistedit UI
  a bit without issue), so I'm thinking we should rip it out and see if
  we get bug reports.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/histedit.py

CHANGE DETAILS

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1623,63 +1623,60 @@
 stdscr.clear()
 stdscr.refresh()
 while True:
-try:
-oldmode, unused = state[b'mode']
-if oldmode == MODE_INIT:
-changemode(state, MODE_RULES)
-e = event(state, ch)
-
-if e == E_QUIT:
-return False
-if e == E_HISTEDIT:
-return state[b'rules']
+oldmode, unused = state[b'mode']
+if oldmode == MODE_INIT:
+changemode(state, MODE_RULES)
+e = event(state, ch)
+
+if e == E_QUIT:
+return False
+if e == E_HISTEDIT:
+return state[b'rules']
+else:
+if e == E_RESIZE:
+size = screen_size()
+if size != stdscr.getmaxyx():
+curses.resizeterm(*size)
+
+curmode, unused = state[b'mode']
+sizes = layout(curmode)
+if curmode != oldmode:
+state[b'page_height'] = sizes[b'main'][0]
+# Adjust the view to fit the current screen size.
+movecursor(state, state[b'pos'], state[b'pos'])
+
+# Pack the windows against the top, each pane spread across the
+# full width of the screen.
+y, x = (0, 0)
+helpwin, y, x = drawvertwin(sizes[b'help'], y, x)
+mainwin, y, x = drawvertwin(sizes[b'main'], y, x)
+commitwin, y, x = drawvertwin(sizes[b'commit'], y, x)
+
+if e in (E_PAGEDOWN, E_PAGEUP, E_LINEDOWN, E_LINEUP):
+if e == E_PAGEDOWN:
+changeview(state, +1, b'page')
+elif e == E_PAGEUP:
+changeview(state, -1, b'page')
+elif e == E_LINEDOWN:
+changeview(state, +1, b'line')
+elif e == E_LINEUP:
+changeview(state, -1, b'line')
+
+# start rendering
+commitwin.erase()
+helpwin.erase()
+mainwin.erase()
+if curmode == MODE_PATCH:
+renderpatch(mainwin, state)
+elif curmode == MODE_HELP:
+renderstring(mainwin, state, __doc__.strip().splitlines())
 else:
-if e == E_RESIZE:
-size = screen_size()
-if size != stdscr.getmaxyx():
-curses.resizeterm(*size)
-
-curmode, unused = state[b'mode']
-sizes = layout(curmode)
-if curmode != oldmode:
-state[b'page_height'] = sizes[b'main'][0]
-# Adjust the view to fit the current screen size.
-movecursor(state, state[b'pos'], state[b'pos'])
-
-# Pack the windows against the top, each pane spread across the
-# full width of the screen.
-y, x = (0, 0)
-helpwin, y, x = drawvertwin(sizes[b'help'], y, x)
-mainwin, y, x = drawvertwin(sizes[b'main'], y, x)
-commitwin, y, x = drawvertwin(sizes[b'commit'], y, x)
-
-if e in (E_PAGEDOWN, E_PAGEUP, E_LINEDOWN, E_LINEUP):
-if e == E_PAGEDOWN:
-changeview(state, +1, b'page')
-elif e == E_PAGEUP:
-changeview(state, -1, b'page')
-elif e == E_LINEDOWN:
-changeview(state, +1, b'line')
-elif e == E_LINEUP:
-changeview(state, -1, b'line')
-
-# start rendering
-commitwin.erase()
-helpwin.erase()
-mainwin.erase()
-if curmode == MODE_PATCH:
-renderpatch(mainwin, state)
-elif curmode == MODE_HELP:
-renderstring(mainwin, state, __doc__.strip().splitlines())
-else:
-renderrules(mainwin, state)
-rendercommit(commitwin, state)
-renderhelp(helpwin, state)
-curses.doupdate()
-# done rendering
-ch = encoding.strtolocal(stdscr.getkey())
-except curses.error:
-pass
+renderrules(mainwin, state)
+

D9854: histedit: notice when the main window underflows height and abort

2021-01-22 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  If you try to have a 13-line-tall terminal and use curses histedit, it
  fails by spinning in an infinite loop due to the catch-all ignore of
  curses errors on line 1682 of histedit.py. We should also fix that
  catch-all ignore of curses errors (what other demons lurk here, I
  wonder?) but we can trivially catch this case and guide the user to a
  happy path. We've seen this mostly in IDE users that have a tendency
  to have really tiny embedded terminal windows.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/histedit.py

CHANGE DETAILS

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1581,10 +1581,19 @@
 def layout(mode):
 maxy, maxx = stdscr.getmaxyx()
 helplen = len(helplines(mode))
+mainlen = maxy - helplen - 12
+if mainlen < 1:
+raise error.Abort(
+_(b"terminal dimensions %d by %d too small for curses 
histedit")
+% (maxy, maxx),
+hint=_(
+b"enlarge your terminal or use --config ui.interface=text"
+),
+)
 return {
 b'commit': (12, maxx),
 b'help': (helplen, maxx),
-b'main': (maxy - helplen - 12, maxx),
+b'main': (mainlen, maxx),
 }
 
 def drawvertwin(size, y, x):



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


D9853: histedit: don't assign to _ for unused values

2021-01-22 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I don't know what this ignored value is, but we need to not clobber
  the _() function from gettext, or we get mysterious crashes instead of
  internationalizing some strings in my upcoming patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/histedit.py

CHANGE DETAILS

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1615,7 +1615,7 @@
 stdscr.refresh()
 while True:
 try:
-oldmode, _ = state[b'mode']
+oldmode, unused = state[b'mode']
 if oldmode == MODE_INIT:
 changemode(state, MODE_RULES)
 e = event(state, ch)
@@ -1630,7 +1630,7 @@
 if size != stdscr.getmaxyx():
 curses.resizeterm(*size)
 
-curmode, _ = state[b'mode']
+curmode, unused = state[b'mode']
 sizes = layout(curmode)
 if curmode != oldmode:
 state[b'page_height'] = sizes[b'main'][0]



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


D9834: black: merge config into main pyproject.toml now that we have it

2021-01-19 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This means that naive contributors who just run `black` on a source file
  will get reasonable behavior as long as they have a recent black. Yay!

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  black.toml
  contrib/examples/fix.hgrc
  pyproject.toml
  tests/test-check-code.t
  tests/test-check-format.t

CHANGE DETAILS

diff --git a/tests/test-check-format.t b/tests/test-check-format.t
--- a/tests/test-check-format.t
+++ b/tests/test-check-format.t
@@ -1,5 +1,5 @@
 #require black test-repo
 
   $ cd $RUNTESTDIR/..
-  $ black --config=black.toml --check --diff `hg files 'set:(**.py + 
grep("^#!.*python")) - mercurial/thirdparty/**'`
+  $ black --check --diff `hg files 'set:(**.py + grep("^#!.*python")) - 
mercurial/thirdparty/**'`
 
diff --git a/tests/test-check-code.t b/tests/test-check-code.t
--- a/tests/test-check-code.t
+++ b/tests/test-check-code.t
@@ -65,7 +65,6 @@
   COPYING
   Makefile
   README.rst
-  black.toml
   hg
   hgeditor
   hgweb.cgi
diff --git a/pyproject.toml b/pyproject.toml
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,3 +1,18 @@
 [build-system]
 requires = ["setuptools", "wheel"]
 build-backend = "setuptools.build_meta"
+
+[tool.black]
+line-length = 80
+exclude = '''
+build/
+| wheelhouse/
+| dist/
+| packages/
+| \.hg/
+| \.mypy_cache/
+| \.venv/
+| mercurial/thirdparty/
+'''
+skip-string-normalization = true
+quiet = true
diff --git a/contrib/examples/fix.hgrc b/contrib/examples/fix.hgrc
--- a/contrib/examples/fix.hgrc
+++ b/contrib/examples/fix.hgrc
@@ -5,7 +5,7 @@
 rustfmt:command = rustfmt +nightly
 rustfmt:pattern = set:"**.rs" - "mercurial/thirdparty/**"
 
-black:command = black --config=black.toml -
+black:command = black
 black:pattern = set:**.py - mercurial/thirdparty/**
 
 # Mercurial doesn't have any Go code, but if we did this is how we
diff --git a/black.toml b/black.toml
deleted file mode 100644
--- a/black.toml
+++ /dev/null
@@ -1,14 +0,0 @@
-[tool.black]
-line-length = 80
-exclude = '''
-build/
-| wheelhouse/
-| dist/
-| packages/
-| \.hg/
-| \.mypy_cache/
-| \.venv/
-| mercurial/thirdparty/
-'''
-skip-string-normalization = true
-quiet = true



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


D9833: pyproject: add config file

2021-01-19 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This will tell pip et al to call our setup.py for the majority of
  packaging concerns, but also gives us a place to put standard config
  stuff like black.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  pyproject.toml
  tests/test-check-code.t

CHANGE DETAILS

diff --git a/tests/test-check-code.t b/tests/test-check-code.t
--- a/tests/test-check-code.t
+++ b/tests/test-check-code.t
@@ -69,6 +69,7 @@
   hg
   hgeditor
   hgweb.cgi
+  pyproject.toml
   rustfmt.toml
   setup.py
 
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,3 @@
+[build-system]
+requires = ["setuptools", "wheel"]
+build-backend = "setuptools.build_meta"



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


D9791: revlog: migrate from PyEval_CallObject to PyObject_Call

2021-01-15 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The former was deprecated in 3.9.0.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/cext/revlog.c

CHANGE DETAILS

diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c
--- a/mercurial/cext/revlog.c
+++ b/mercurial/cext/revlog.c
@@ -498,7 +498,7 @@
return -1;
}
 
-   result = PyEval_CallObject(filter, arglist);
+   result = PyObject_Call(filter, arglist, NULL);
Py_DECREF(arglist);
if (!result) {
return -1;



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


D9790: fuzz: fix Makefile default PYTHON_CONFIG_FLAGS to be modern

2021-01-15 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is actually what we already do on oss-fuzz, so it's more correct as tests
  go.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/fuzz/Makefile

CHANGE DETAILS

diff --git a/contrib/fuzz/Makefile b/contrib/fuzz/Makefile
--- a/contrib/fuzz/Makefile
+++ b/contrib/fuzz/Makefile
@@ -11,7 +11,7 @@
 LIB_FUZZING_ENGINE ?= standalone_fuzz_target_runner.o
 
 PYTHON_CONFIG ?= $$OUT/sanpy/bin/python-config
-PYTHON_CONFIG_FLAGS ?= --ldflags
+PYTHON_CONFIG_FLAGS ?= --ldflags --embed
 
 CXXFLAGS += -Wno-deprecated-register
 



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


D9752: fuzz: try and ensure fuzzer tests run against the right python-config

2021-01-13 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Also only under python 3.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/fuzz/Makefile
  tests/test-fuzz-targets.t

CHANGE DETAILS

diff --git a/tests/test-fuzz-targets.t b/tests/test-fuzz-targets.t
--- a/tests/test-fuzz-targets.t
+++ b/tests/test-fuzz-targets.t
@@ -1,4 +1,4 @@
-#require test-repo
+#require test-repo py3
 
   $ cd $TESTDIR/../contrib/fuzz
   $ OUT=$TESTTMP ; export OUT
@@ -26,13 +26,23 @@
   >-fsanitize=fuzzer-no-link,address || return 1
   > }
 
+Try to find a python3-config that's next to our sys.executable. If
+that doesn't work, fall back to looking for a global python3-config
+and hope that works out for the best.
+  $ PYBIN=`$PYTHON -c 'import sys, os; print(os.path.dirname(sys.executable))'`
+  $ if [ -x "$PYBIN/python3-config" ] ; then
+  >   PYTHON_CONFIG="$PYBIN/python3-config"
+  > else
+  >   PYTHON_CONFIG="`which python3-config`"
+  > fi
+
 #if clang-libfuzzer
   $ CXX=clang++ havefuzz || exit 80
-  $ $MAKE -s clean all PYTHON_CONFIG=`which python-config`
+  $ $MAKE -s clean all PYTHON_CONFIG="$PYTHON_CONFIG"
 #endif
 #if no-clang-libfuzzer clang-6.0
   $ CXX=clang++-6.0 havefuzz || exit 80
-  $ $MAKE -s clean all CC=clang-6.0 CXX=clang++-6.0 PYTHON_CONFIG=`which 
python-config`
+  $ $MAKE -s clean all CC=clang-6.0 CXX=clang++-6.0 
PYTHON_CONFIG="$PYTHON_CONFIG"
 #endif
 #if no-clang-libfuzzer no-clang-6.0
   $ exit 80
diff --git a/contrib/fuzz/Makefile b/contrib/fuzz/Makefile
--- a/contrib/fuzz/Makefile
+++ b/contrib/fuzz/Makefile
@@ -23,6 +23,7 @@
python $< $@
 
 pyutil.o: pyutil.cc pyutil.h
+   $(PYTHON_CONFIG) --cflags
$(CXX) $(CXXFLAGS) -g -O1 \
  `$(PYTHON_CONFIG) --cflags` \
  -I../../mercurial -c -o pyutil.o pyutil.cc



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


D9561: histedit: adjust comment describing `edit` action for clarity

2020-12-10 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/histedit.py
  tests/test-histedit-arguments.t
  tests/test-histedit-bookmark-motion.t
  tests/test-histedit-commute.t
  tests/test-histedit-edit.t
  tests/test-histedit-obsolete.t
  tests/test-histedit-outgoing.t

CHANGE DETAILS

diff --git a/tests/test-histedit-outgoing.t b/tests/test-histedit-outgoing.t
--- a/tests/test-histedit-outgoing.t
+++ b/tests/test-histedit-outgoing.t
@@ -49,7 +49,7 @@
   #
   # Commands:
   #
-  #  e, edit = use commit, but stop for amending
+  #  e, edit = use commit, but allow edits before making new commit
   #  m, mess = edit commit message without changing commit content
   #  p, pick = use commit
   #  b, base = checkout changeset and apply further changesets from there
@@ -84,7 +84,7 @@
   #
   # Commands:
   #
-  #  e, edit = use commit, but stop for amending
+  #  e, edit = use commit, but allow edits before making new commit
   #  m, mess = edit commit message without changing commit content
   #  p, pick = use commit
   #  b, base = checkout changeset and apply further changesets from there
@@ -111,7 +111,7 @@
   #
   # Commands:
   #
-  #  e, edit = use commit, but stop for amending
+  #  e, edit = use commit, but allow edits before making new commit
   #  m, mess = edit commit message without changing commit content
   #  p, pick = use commit
   #  b, base = checkout changeset and apply further changesets from there
diff --git a/tests/test-histedit-obsolete.t b/tests/test-histedit-obsolete.t
--- a/tests/test-histedit-obsolete.t
+++ b/tests/test-histedit-obsolete.t
@@ -139,7 +139,7 @@
   #
   # Commands:
   #
-  #  e, edit = use commit, but stop for amending
+  #  e, edit = use commit, but allow edits before making new commit
   #  m, mess = edit commit message without changing commit content
   #  p, pick = use commit
   #  b, base = checkout changeset and apply further changesets from there
diff --git a/tests/test-histedit-edit.t b/tests/test-histedit-edit.t
--- a/tests/test-histedit-edit.t
+++ b/tests/test-histedit-edit.t
@@ -475,7 +475,7 @@
   #
   # Commands:
   #
-  #  e, edit = use commit, but stop for amending
+  #  e, edit = use commit, but allow edits before making new commit
   #  m, mess = edit commit message without changing commit content
   #  p, fold = use commit
   #  b, base = checkout changeset and apply further changesets from there
diff --git a/tests/test-histedit-commute.t b/tests/test-histedit-commute.t
--- a/tests/test-histedit-commute.t
+++ b/tests/test-histedit-commute.t
@@ -68,7 +68,7 @@
   #
   # Commands:
   #
-  #  e, edit = use commit, but stop for amending
+  #  e, edit = use commit, but allow edits before making new commit
   #  m, mess = edit commit message without changing commit content
   #  p, pick = use commit
   #  b, base = checkout changeset and apply further changesets from there
@@ -94,7 +94,7 @@
   #
   # Commands:
   #
-  #  e, edit = use commit, but stop for amending
+  #  e, edit = use commit, but allow edits before making new commit
   #  m, mess = edit commit message without changing commit content
   #  p, pick = use commit
   #  b, base = checkout changeset and apply further changesets from there
@@ -120,7 +120,7 @@
   #
   # Commands:
   #
-  #  e, edit = use commit, but stop for amending
+  #  e, edit = use commit, but allow edits before making new commit
   #  m, mess = edit commit message without changing commit content
   #  p, pick = use commit
   #  b, base = checkout changeset and apply further changesets from there
@@ -405,7 +405,7 @@
   #
   # Commands:
   #
-  #  e, edit = use commit, but stop for amending
+  #  e, edit = use commit, but allow edits before making new commit
   #  m, mess = edit commit message without changing commit content
   #  p, pick = use commit
   #  b, base = checkout changeset and apply further changesets from there
diff --git a/tests/test-histedit-bookmark-motion.t 
b/tests/test-histedit-bookmark-motion.t
--- a/tests/test-histedit-bookmark-motion.t
+++ b/tests/test-histedit-bookmark-motion.t
@@ -73,7 +73,7 @@
   #
   # Commands:
   #
-  #  e, edit = use commit, but stop for amending
+  #  e, edit = use commit, but allow edits before making new commit
   #  m, mess = edit commit message without changing commit content
   #  p, pick = use commit
   #  b, base = checkout changeset and apply further changesets from there
@@ -130,7 +130,7 @@
   #
   # Commands:
   #
-  #  e, edit = use commit, but stop for amending
+  #  e, edit = use commit, but allow edits before making new commit
   #  m, mess = edit commit message without changing commit content
   #  p, pick = use commit
   #  b, base = checkout changeset and apply further changesets from there
diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t
--- 

D9560: histedit: tweak `edit` message to try and guide users to our workflow

2020-12-10 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  histedit predates evolve, so it drops you on an _uncommitted_ version
  of the commit you're amending/splitting, which is in contrast to git
  which expects you to use `git commit --amend` (I think - I'm basing
  this on internal bug reports). My hope is that this output will guide
  users a little more towards the expected workflow.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/histedit.py
  tests/test-histedit-arguments.t
  tests/test-histedit-commute.t
  tests/test-histedit-edit.t
  tests/test-histedit-no-backup.t
  tests/test-histedit-no-change.t
  tests/test-histedit-obsolete.t
  tests/test-qrecord.t
  tests/test-rebase-pull.t

CHANGE DETAILS

diff --git a/tests/test-rebase-pull.t b/tests/test-rebase-pull.t
--- a/tests/test-rebase-pull.t
+++ b/tests/test-rebase-pull.t
@@ -88,8 +88,8 @@
   $ hg histedit . -q --commands - << EOF
   > edit d80cc2da061e histedit: generate unfinished state
   > EOF
-  Editing (d80cc2da061e), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (d80cc2da061e), commit as needed now to split the change
+  (to amend d80cc2da061e, `hg histedit --continue` after making changes)
   [240]
   $ hg pull --rebase
   abort: histedit in progress
diff --git a/tests/test-qrecord.t b/tests/test-qrecord.t
--- a/tests/test-qrecord.t
+++ b/tests/test-qrecord.t
@@ -456,8 +456,8 @@
   > edit ea55e2ae468f foo bar
   > EOF
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  Editing (ea55e2ae468f), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (ea55e2ae468f), commit as needed now to split the change
+  (to amend ea55e2ae468f, `hg histedit --continue` after making changes)
   [240]
   $ echo 'foo bar' > a
   $ hg qrecord -d '0 0' -m aaa a.patch <> plan
   $ echo "edit `hg log -r 1 -T '{node|short}'`" >> plan
   $ hg histedit -r 'all()' --commands plan
-  Editing (1b2d564fad96), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (1b2d564fad96), commit as needed now to split the change
+  (to amend 1b2d564fad96, `hg histedit --continue` after making changes)
   [240]
   $ hg st
   A b
@@ -70,8 +70,8 @@
   $ echo "pick `hg log -r 5 -T '{node|short}'`" >> plan
   $ echo "edit `hg log -r 4 -T '{node|short}'`" >> plan
   $ hg histedit -r 'all()' --commands plan
-  Editing (49d44ab2be1b), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (49d44ab2be1b), commit as needed now to split the change
+  (to amend 49d44ab2be1b, `hg histedit --continue` after making changes)
   [240]
   $ hg st
   A b
@@ -225,8 +225,8 @@
   > edit b346ab9a313d 6 c
   > EOF
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  Editing (b346ab9a313d), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (b346ab9a313d), commit as needed now to split the change
+  (to amend b346ab9a313d, `hg histedit --continue` after making changes)
   [240]
   $ echo c >> c
   $ hg histedit --continue
@@ -359,8 +359,8 @@
   > pick ee118ab9fa44 16 k
   > EOF
   0 files updated, 0 files merged, 6 files removed, 0 files unresolved
-  Editing (b449568bf7fc), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (b449568bf7fc), commit as needed now to split the change
+  (to amend b449568bf7fc, `hg histedit --continue` after making changes)
   [240]
   $ echo f >> f
   $ hg histedit --continue
@@ -401,8 +401,8 @@
   > pick ee118ab9fa44 16 k
   > EOF
   0 files updated, 0 files merged, 6 files removed, 0 files unresolved
-  Editing (b449568bf7fc), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (b449568bf7fc), commit as needed now to split the change
+  (to amend b449568bf7fc, `hg histedit --continue` after making changes)
   [240]
   $ echo f >> f
   $ hg histedit --continue
@@ -527,8 +527,8 @@
   > roll 3a6c53ee7f3d 17 j
   > edit ee118ab9fa44 18 k
   > EOF
-  Editing (ee118ab9fa44), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (ee118ab9fa44), commit as needed now to split the change
+  (to amend ee118ab9fa44, `hg histedit --continue` after making changes)
   [240]
 
 #if abortcommand
@@ -566,8 +566,8 @@
   > pick 3a6c53ee7f3d 17 j
   > edit ee118ab9fa44 18 k
   > EOF
-  Editing (ee118ab9fa44), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (ee118ab9fa44), commit as needed now to split the change
+  (to amend ee118ab9fa44, `hg histedit --continue` after making changes)
   [240]
   $ hg histedit --continue --config experimental.evolution.track-operation=1
   $ hg log -G
diff --git a/tests/test-histedit-no-change.t b/tests/test-histedit-no-change.t

D9471: procutil: correctly convert to bytes when shell=False

2020-11-30 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/utils/procutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py
--- a/mercurial/utils/procutil.py
+++ b/mercurial/utils/procutil.py
@@ -654,9 +654,13 @@
 stdin.write(stdin_bytes)
 stdin.flush()
 stdin.seek(0)
+if shell:
+script = tonativestr(script)
+else:
+script = [tonativestr(s) for s in script]
 
 p = subprocess.Popen(
-tonativestr(script),
+script,
 shell=shell,
 env=tonativeenv(env),
 close_fds=True,



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


D9430: formating: upgrade to black 20.8b1

2020-11-27 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: indygreg.
Herald added a reviewer: martinvonz.
Herald added a reviewer: martinvonz.
Herald added subscribers: mercurial-patches, Kwan.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This required a couple of small tweaks to un-confuse black, but now it
  works. Big formatting changes come from:
  
  - Dramatically improved collection-splitting logic upstream
  - Black having a strong (correct IMO) opinion that """ is better than '''

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/automation/hgautomation/aws.py
  contrib/automation/hgautomation/cli.py
  contrib/automation/hgautomation/windows.py
  contrib/byteify-strings.py
  contrib/check-code.py
  contrib/packaging/hgpackaging/cli.py
  contrib/packaging/hgpackaging/inno.py
  contrib/packaging/hgpackaging/wix.py
  contrib/perf.py
  contrib/python-hook-examples.py
  contrib/python-zstandard/make_cffi.py
  contrib/python3-ratchet.py
  contrib/synthrepo.py
  contrib/testparseutil.py
  doc/hgmanpage.py
  hgext/acl.py
  hgext/automv.py
  hgext/blackbox.py
  hgext/bugzilla.py
  hgext/churn.py
  hgext/convert/__init__.py
  hgext/convert/bzr.py
  hgext/convert/common.py
  hgext/convert/convcmd.py
  hgext/convert/cvsps.py
  hgext/convert/filemap.py
  hgext/eol.py
  hgext/extdiff.py
  hgext/factotum.py
  hgext/fetch.py
  hgext/fix.py
  hgext/fsmonitor/__init__.py
  hgext/fsmonitor/pywatchman/__init__.py
  hgext/fsmonitor/pywatchman/capabilities.py
  hgext/git/__init__.py
  hgext/git/manifest.py
  hgext/githelp.py
  hgext/gpg.py
  hgext/hgk.py
  hgext/histedit.py
  hgext/hooklib/changeset_obsoleted.py
  hgext/hooklib/changeset_published.py
  hgext/infinitepush/__init__.py
  hgext/infinitepush/bundleparts.py
  hgext/infinitepush/indexapi.py
  hgext/infinitepush/sqlindexapi.py
  hgext/keyword.py
  hgext/largefiles/__init__.py
  hgext/largefiles/basestore.py
  hgext/largefiles/lfcommands.py
  hgext/largefiles/lfutil.py
  hgext/largefiles/localstore.py
  hgext/largefiles/overrides.py
  hgext/largefiles/proto.py
  hgext/largefiles/remotestore.py
  hgext/largefiles/reposetup.py
  hgext/largefiles/wirestore.py
  hgext/lfs/__init__.py
  hgext/lfs/blobstore.py
  hgext/lfs/wrapper.py
  hgext/mq.py
  hgext/narrow/narrowbundle2.py
  hgext/narrow/narrowwirepeer.py
  hgext/notify.py
  hgext/pager.py
  hgext/patchbomb.py
  hgext/phabricator.py
  hgext/purge.py
  hgext/rebase.py
  hgext/record.py
  hgext/remotefilelog/__init__.py
  hgext/remotefilelog/basestore.py
  hgext/remotefilelog/contentstore.py
  hgext/remotefilelog/fileserverclient.py
  hgext/remotefilelog/remotefilectx.py
  hgext/remotefilelog/remotefilelogserver.py
  hgext/remotefilelog/repack.py
  hgext/remotefilelog/shallowrepo.py
  hgext/remotenames.py
  hgext/schemes.py
  hgext/share.py
  hgext/transplant.py
  hgext/uncommit.py
  hgext/win32mbcs.py
  hgext/win32text.py
  i18n/check-translation.py
  mercurial/ancestor.py
  mercurial/archival.py
  mercurial/bookmarks.py
  mercurial/branchmap.py
  mercurial/bundle2.py
  mercurial/bundlerepo.py
  mercurial/changelog.py
  mercurial/cmdutil.py
  mercurial/commands.py
  mercurial/commandserver.py
  mercurial/commit.py
  mercurial/config.py
  mercurial/configitems.py
  mercurial/context.py
  mercurial/copies.py
  mercurial/crecord.py
  mercurial/dagop.py
  mercurial/dagparser.py
  mercurial/debugcommands.py
  mercurial/diffutil.py
  mercurial/dirstate.py
  mercurial/dirstateguard.py
  mercurial/discovery.py
  mercurial/dispatch.py
  mercurial/encoding.py
  mercurial/error.py
  mercurial/exchange.py
  mercurial/exchangev2.py
  mercurial/extensions.py
  mercurial/filemerge.py
  mercurial/fileset.py
  mercurial/help.py
  mercurial/hg.py
  mercurial/hgweb/__init__.py
  mercurial/hgweb/common.py
  mercurial/hgweb/hgweb_mod.py
  mercurial/hgweb/request.py
  mercurial/hgweb/webutil.py
  mercurial/hook.py
  mercurial/httppeer.py
  mercurial/interfaces/dirstate.py
  mercurial/interfaces/repository.py
  mercurial/keepalive.py
  mercurial/localrepo.py
  mercurial/lock.py
  mercurial/logcmdutil.py
  mercurial/logexchange.py
  mercurial/mail.py
  mercurial/manifest.py
  mercurial/match.py
  mercurial/mdiff.py
  mercurial/merge.py
  mercurial/mergestate.py
  mercurial/metadata.py
  mercurial/minirst.py
  mercurial/narrowspec.py
  mercurial/obsolete.py
  mercurial/obsutil.py
  mercurial/parser.py
  mercurial/patch.py
  mercurial/pathutil.py
  mercurial/posix.py
  mercurial/progress.py
  mercurial/pure/charencode.py
  mercurial/pure/mpatch.py
  mercurial/pure/osutil.py
  mercurial/pure/parsers.py
  mercurial/rcutil.py
  mercurial/registrar.py
  mercurial/repoview.py
  mercurial/revlog.py
  mercurial/revlogutils/nodemap.py
  mercurial/revset.py
  mercurial/revsetlang.py
  mercurial/scmutil.py
  mercurial/setdiscovery.py
  mercurial/shelve.py
  mercurial/similar.py
  mercurial/simplemerge.py
  mercurial/sshpeer.py
  mercurial/sslutil.py
  

D9428: merge: remove spurious ' and trailing whitespace from triple-quoted string

2020-11-27 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/merge.py

CHANGE DETAILS

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -544,10 +544,10 @@
 
 
 class mergeresult(object):
-An object representing result of merging manifests.
+'''An object representing result of merging manifests.
 
 It has information about what actions need to be performed on dirstate
-mapping of divergent renames and other such cases. '''
+mapping of divergent renames and other such cases.'''
 
 def __init__(self):
 """



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


D9429: osutil: reformat triple-quoted string so black doesn't confuse itself

2020-11-27 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/pure/osutil.py

CHANGE DETAILS

diff --git a/mercurial/pure/osutil.py b/mercurial/pure/osutil.py
--- a/mercurial/pure/osutil.py
+++ b/mercurial/pure/osutil.py
@@ -293,7 +293,8 @@
 '''mimics the read-only attributes of Python file objects
 by raising 'TypeError: readonly attribute' if someone tries:
   f = posixfile('foo.txt')
-  f.name = 'bla'  '''
+  f.name = 'bla'
+'''
 return self._file.__setattr__(name, value)
 
 def __enter__(self):



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


D9403: git: update test for hg and git output changes

2020-11-25 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Clearly nobody is running this in their CI. :(

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-git-interop.t

CHANGE DETAILS

diff --git a/tests/test-git-interop.t b/tests/test-git-interop.t
--- a/tests/test-git-interop.t
+++ b/tests/test-git-interop.t
@@ -67,8 +67,8 @@
 
 Without creating the .hg, hg status fails:
   $ hg status
-  abort: no repository found in '$TESTTMP/foo' (.hg not found)!
-  [255]
+  abort: no repository found in '$TESTTMP/foo' (.hg not found)
+  [10]
 But if you run hg init --git, it works:
   $ hg init --git
   $ hg id --traceback
@@ -304,14 +304,10 @@
   $ hg status
   heads mismatch, rebuilding dagcache
   M beta
-  $ git status
+  $ git status | egrep -v '^$|^  \(use '
   On branch master
   Changes not staged for commit:
-(use "git add ..." to update what will be committed)
-(use "git checkout -- ..." to discard changes in working directory)
-  
modified:   beta
-  
   no changes added to commit (use "git add" and/or "git commit -a")
 
 Contents of each commit should be the same



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


D9402: gitlog: add tiprev() function

2020-11-25 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Lots of stuff was broken because this was missing.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/git/gitlog.py

CHANGE DETAILS

diff --git a/hgext/git/gitlog.py b/hgext/git/gitlog.py
--- a/hgext/git/gitlog.py
+++ b/hgext/git/gitlog.py
@@ -148,6 +148,14 @@
 )
 return (int(r[0]) for r in t)
 
+def tiprev(self):
+t = self._db.execute(
+'SELECT rev FROM changelog '
+'ORDER BY REV DESC '
+'LIMIT 1'
+)
+return next(t)
+
 def _partialmatch(self, id):
 if nodemod.wdirhex.startswith(id):
 raise error.WdirUnsupported



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


D9401: pyoxidizer: make sure defaultrc directory exists before trying to write to it

2020-11-25 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  When doing some work involving one-file binaries, this line is failing
  for me. It seems reasonable to just make sure the destination
  directory exists before splatting the file into it.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/packaging/hgpackaging/pyoxidizer.py

CHANGE DETAILS

diff --git a/contrib/packaging/hgpackaging/pyoxidizer.py 
b/contrib/packaging/hgpackaging/pyoxidizer.py
--- a/contrib/packaging/hgpackaging/pyoxidizer.py
+++ b/contrib/packaging/hgpackaging/pyoxidizer.py
@@ -127,6 +127,7 @@
 
 # Write out a default editor.rc file to configure notepad as the
 # default editor.
+os.makedirs(out_dir / "defaultrc")
 with (out_dir / "defaultrc" / "editor.rc").open(
 "w", encoding="utf-8"
 ) as fh:



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


D9342: pyoxidizer: run buildifier

2020-11-19 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hgcli/pyoxidizer.bzl

CHANGE DETAILS

diff --git a/rust/hgcli/pyoxidizer.bzl b/rust/hgcli/pyoxidizer.bzl
--- a/rust/hgcli/pyoxidizer.bzl
+++ b/rust/hgcli/pyoxidizer.bzl
@@ -17,6 +17,7 @@
 if not IS_WINDOWS:
 resource.add_location = "in-memory"
 return
+
 # We use a custom resource routing policy to influence where things are 
loaded
 # from.
 #
@@ -39,6 +40,7 @@
 def make_exe(dist):
 """Builds a Rust-wrapped Mercurial binary."""
 packaging_policy = dist.make_python_packaging_policy()
+
 # Extension may depend on any Python functionality. Include all
 # extensions.
 packaging_policy.extension_module_filter = "all"
@@ -50,8 +52,10 @@
 config = dist.make_python_interpreter_config()
 config.raw_allocator = "system"
 config.run_command = RUN_CODE
+
 # We want to let the user load extensions from the file system
 config.filesystem_importer = True
+
 # We need this to make resourceutil happy, since it looks for sys.frozen.
 config.sys_frozen = True
 config.legacy_windows_stdio = True



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


D9290: pyoxidizer: switch to modern config using run_command instead of run_mode

2020-11-10 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hgcli/pyoxidizer.bzl

CHANGE DETAILS

diff --git a/rust/hgcli/pyoxidizer.bzl b/rust/hgcli/pyoxidizer.bzl
--- a/rust/hgcli/pyoxidizer.bzl
+++ b/rust/hgcli/pyoxidizer.bzl
@@ -49,7 +49,7 @@
 
 config = dist.make_python_interpreter_config()
 config.raw_allocator = "system"
-config.run_mode = "eval:%s" % RUN_CODE
+config.run_command = RUN_CODE
 # We want to let the user load extensions from the file system
 config.filesystem_importer = True
 # We need this to make resourceutil happy, since it looks for sys.frozen.



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


D9289: pyoxidizer: default to one-file binary on non-Windows platforms

2020-11-10 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Windows has some extra constraints that require a multi-file install,
  but we expect folks to use an MSI or similar installer there so it's
  less of a big deal.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hgcli/pyoxidizer.bzl

CHANGE DETAILS

diff --git a/rust/hgcli/pyoxidizer.bzl b/rust/hgcli/pyoxidizer.bzl
--- a/rust/hgcli/pyoxidizer.bzl
+++ b/rust/hgcli/pyoxidizer.bzl
@@ -14,6 +14,9 @@
 return default_python_distribution(flavor = "standalone_dynamic")
 
 def resource_callback(policy, resource):
+if not IS_WINDOWS:
+resource.add_location = "in-memory"
+return
 # We use a custom resource routing policy to influence where things are 
loaded
 # from.
 #
@@ -40,7 +43,8 @@
 # extensions.
 packaging_policy.extension_module_filter = "all"
 packaging_policy.resources_location = "in-memory"
-packaging_policy.resources_location_fallback = "filesystem-relative:lib"
+if IS_WINDOWS:
+packaging_policy.resources_location_fallback = 
"filesystem-relative:lib"
 packaging_policy.register_resource_callback(resource_callback)
 
 config = dist.make_python_interpreter_config()



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


D9291: make: add a pyoxidizer target

2020-11-10 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  Makefile

CHANGE DETAILS

diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -15,6 +15,8 @@
 PYTHON?=python3
 endif
 
+PYOXIDIZER?=pyoxidizer
+
 $(eval HGROOT := $(shell pwd))
 HGPYTHONS ?= $(HGROOT)/build/pythons
 PURE=
@@ -259,9 +261,12 @@
  --resources contrib/packaging/macosx/ \
  "$${OUTPUTDIR:-dist/}"/Mercurial-"$${HGVER}"-macosx"$${OSXVER}".pkg
 
+pyoxidizer:
+   $(PYOXIDIZER) build --path ./rust/hgcli --release
+
 .PHONY: help all local build doc cleanbutpackages clean install install-bin \
install-doc install-home install-home-bin install-home-doc \
dist dist-notests check tests rust-tests check-code format-c \
-   update-pot \
+   update-pot pyoxidizer \
$(packaging_targets) \
osx



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


D9062: git: also convert timezone to int (issue6359)

2020-09-21 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Credit to moshez for testing this in the wild.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/git/gitlog.py

CHANGE DETAILS

diff --git a/hgext/git/gitlog.py b/hgext/git/gitlog.py
--- a/hgext/git/gitlog.py
+++ b/hgext/git/gitlog.py
@@ -389,7 +389,7 @@
 sig = pygit2.Signature(
 encoding.unifromlocal(stringutil.person(user)),
 encoding.unifromlocal(stringutil.email(user)),
-timestamp,
+int(timestamp),
 -int(tz // 60),
 )
 oid = self.gitrepo.create_commit(



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


D9004: hgdemandimport: bypass demandimport for _ast module (issue6407)

2020-09-09 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is broken on Python 3.9rc1, and while it sounds like there may be
  a fix in Python, we probably also should have this workaround in place
  in hg. See the bug for more details (including on bugs at redhat and
  b.p.o).

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  hgdemandimport/__init__.py

CHANGE DETAILS

diff --git a/hgdemandimport/__init__.py b/hgdemandimport/__init__.py
--- a/hgdemandimport/__init__.py
+++ b/hgdemandimport/__init__.py
@@ -46,6 +46,7 @@
 # setuptools' pkg_resources.py expects "from __main__ import x" to
 # raise ImportError if x not defined
 '__main__',
+'_ast', # https://bugs.python.org/issue41631
 '_ssl',  # conditional imports in the stdlib, issue1964
 '_sre',  # issue4920
 'rfc822',



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


D8999: git: fix index handling of removed files during commit (issue6398)

2020-09-07 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Other changes in this series also changed the behavior here in
  positive ways, but this was the final step that actually fixed things.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/git/dirstate.py
  tests/test-git-interop.t

CHANGE DETAILS

diff --git a/tests/test-git-interop.t b/tests/test-git-interop.t
--- a/tests/test-git-interop.t
+++ b/tests/test-git-interop.t
@@ -270,3 +270,8 @@
   +++ b/beta   Mon Jan 01 00:00:11 2007 +
   @@ -0,0 +1,1 @@
   +beta
+
+
+Deleting files should also work (this was issue6398)
+  $ hg rm beta
+  $ hg ci -m 'remove beta'
diff --git a/hgext/git/dirstate.py b/hgext/git/dirstate.py
--- a/hgext/git/dirstate.py
+++ b/hgext/git/dirstate.py
@@ -301,8 +301,10 @@
 def drop(self, f):
 index = self.git.index
 index.read()
-index.remove(pycompat.fsdecode(f))
-index.write()
+fs = pycompat.fsdecode(f)
+if fs in index:
+index.remove(fs)
+index.write()
 
 def remove(self, f):
 index = self.git.index



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


D8998: git: make dirstate actually support listclean parameter

2020-09-07 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  As far as I can tell listignored and listunknown should already
  work. I'm vexed that there doesn't seem to be a way to get clean files
  out of the pygit2 status method, but this at least makes things work
  better.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/git/dirstate.py

CHANGE DETAILS

diff --git a/hgext/git/dirstate.py b/hgext/git/dirstate.py
--- a/hgext/git/dirstate.py
+++ b/hgext/git/dirstate.py
@@ -129,6 +129,7 @@
 return False
 
 def status(self, match, subrepos, ignored, clean, unknown):
+listignored, listclean, listunknown = ignored, clean, unknown
 # TODO handling of clean files - can we get that from git.status()?
 modified, added, removed, deleted, unknown, ignored, clean = (
 [],
@@ -168,6 +169,20 @@
 b'unhandled case: status for %r is %r' % (path, status)
 )
 
+if listclean:
+observed = set(modified + added + removed + deleted + unknown + 
ignored)
+index = self.git.index
+index.read()
+for entry in index:
+path = pycompat.fsencode(entry.path)
+if not match(path):
+continue
+if path in observed:
+continue # already in some other set
+if path[-1] == b'/':
+continue # directory
+clean.append(path)
+
 # TODO are we really always sure of status here?
 return (
 False,



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


D8994: localrepo: use functools.wraps() in unfilteredmethod decorator

2020-09-07 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This makes it easier to figure out what function you're holding on to
  when doing printf-style debugging.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -8,6 +8,7 @@
 from __future__ import absolute_import
 
 import errno
+import functools
 import os
 import random
 import sys
@@ -193,6 +194,7 @@
 def unfilteredmethod(orig):
 """decorate method that always need to be run on unfiltered version"""
 
+@functools.wraps(orig)
 def wrapper(repo, *args, **kwargs):
 return orig(repo.unfiltered(), *args, **kwargs)
 



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


D8997: git: make dirstate status() respect matcher

2020-09-07 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  As with other changes in this stack, we appear to have been getting
  lucky in the past. An upcoming change behaved _very_ oddly without
  this fix.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/git/dirstate.py

CHANGE DETAILS

diff --git a/hgext/git/dirstate.py b/hgext/git/dirstate.py
--- a/hgext/git/dirstate.py
+++ b/hgext/git/dirstate.py
@@ -142,6 +142,8 @@
 gstatus = self.git.status()
 for path, status in gstatus.items():
 path = pycompat.fsencode(path)
+if not match(path):
+continue
 if status == pygit2.GIT_STATUS_IGNORED:
 if path.endswith(b'/'):
 continue



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


D8996: git: fix up dirstate use of index

2020-09-07 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This was super-broken before, and somehow none of the existing
  attempts to use this code tripped on the defects here. Sigh.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/git/dirstate.py

CHANGE DETAILS

diff --git a/hgext/git/dirstate.py b/hgext/git/dirstate.py
--- a/hgext/git/dirstate.py
+++ b/hgext/git/dirstate.py
@@ -276,13 +276,22 @@
 pass
 
 def add(self, f):
-self.git.index.add(pycompat.fsdecode(f))
+index = self.git.index
+index.read()
+index.add(pycompat.fsdecode(f))
+index.write()
 
 def drop(self, f):
-self.git.index.remove(pycompat.fsdecode(f))
+index = self.git.index
+index.read()
+index.remove(pycompat.fsdecode(f))
+index.write()
 
 def remove(self, f):
-self.git.index.remove(pycompat.fsdecode(f))
+index = self.git.index
+index.read()
+index.remove(pycompat.fsdecode(f))
+index.write()
 
 def copied(self, path):
 # TODO: track copies?



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


D8995: git: correctly handle "nothing changed" commits

2020-09-07 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I guess localrepo.commit() actually returns an Optional[node], which
  is a bit of a surprise to me.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/git/__init__.py

CHANGE DETAILS

diff --git a/hgext/git/__init__.py b/hgext/git/__init__.py
--- a/hgext/git/__init__.py
+++ b/hgext/git/__init__.py
@@ -297,6 +297,10 @@
 
 def commit(self, *args, **kwargs):
 ret = orig.commit(self, *args, **kwargs)
+if ret is None:
+# there was nothing to commit, so we should skip
+# the index fixup logic we'd otherwise do.
+return None
 tid = self.store.git[gitutil.togitnode(ret)].tree.id
 # DANGER! This will flush any writes staged to the
 # index in Git, but we're sidestepping the index in a



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


D8993: git: actually copy treemanifest instances in .copy() (issue6398)

2020-09-07 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The implementation here is so simple I honestly have no idea why I
  didn't do it at the time. Hopefully there's not some nuance past-me
  forgot to write down.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/git/manifest.py

CHANGE DETAILS

diff --git a/hgext/git/manifest.py b/hgext/git/manifest.py
--- a/hgext/git/manifest.py
+++ b/hgext/git/manifest.py
@@ -1,6 +1,7 @@
 from __future__ import absolute_import
 
 from mercurial import (
+error,
 match as matchmod,
 pathutil,
 pycompat,
@@ -217,7 +218,7 @@
 return b''
 
 def copy(self):
-pass
+return gittreemanifest(self._git_repo, self._tree, 
dict(self._pending_changes))
 
 def items(self):
 for f in self:



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


D8992: git: restore basic functionality after b3040b6739ce

2020-09-07 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We don't yet have a formal interface for the changelog, but it's
  mostly specified. Sadly, b3040b6739ce 
 
added a semi-private pseudo-enum
  that we need to cope with, so it's probably high time that someone
  (me?) attempts to define that interface to prevent future backsliding.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/git/gitlog.py

CHANGE DETAILS

diff --git a/hgext/git/gitlog.py b/hgext/git/gitlog.py
--- a/hgext/git/gitlog.py
+++ b/hgext/git/gitlog.py
@@ -96,6 +96,10 @@
 
 # TODO: an interface for the changelog type?
 class changelog(baselog):
+# TODO: this appears to be an enumerated type, and should probably
+# be part of the public changelog interface
+_copiesstorage = b'extra'
+
 def __contains__(self, rev):
 try:
 self.node(rev)



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


D8991: git: convert tz offset to int (issue6359)

2020-09-07 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/git/gitlog.py

CHANGE DETAILS

diff --git a/hgext/git/gitlog.py b/hgext/git/gitlog.py
--- a/hgext/git/gitlog.py
+++ b/hgext/git/gitlog.py
@@ -386,7 +386,7 @@
 encoding.unifromlocal(stringutil.person(user)),
 encoding.unifromlocal(stringutil.email(user)),
 timestamp,
--(tz // 60),
+-int(tz // 60),
 )
 oid = self.gitrepo.create_commit(
 None, sig, sig, desc, gitutil.togitnode(manifest), parents



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


D8975: genosxversion: don't give up if we can't find a path to hg libraries

2020-09-01 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This doesn't work if you have a PyOxidized hg on $PATH, but everything
  is fine if you just ignore that problem.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  contrib/genosxversion.py

CHANGE DETAILS

diff --git a/contrib/genosxversion.py b/contrib/genosxversion.py
--- a/contrib/genosxversion.py
+++ b/contrib/genosxversion.py
@@ -6,9 +6,14 @@
 import subprocess
 import sys
 
-# Always load hg libraries from the hg we can find on $PATH.
-hglib = subprocess.check_output(['hg', 'debuginstall', '-T', '{hgmodules}'])
-sys.path.insert(0, os.path.dirname(hglib))
+try:
+# Always load hg libraries from the hg we can find on $PATH.
+hglib = subprocess.check_output(['hg', 'debuginstall', '-T', 
'{hgmodules}'])
+sys.path.insert(0, os.path.dirname(hglib))
+except subprocess.CalledProcessError:
+# We're probably running with a PyOxidized Mercurial, so just
+# proceed and hope it works out okay.
+pass
 
 from mercurial import util
 



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


D8353: debugcommands: create new debugantivirusrunning command

2020-07-17 Thread durin42 (Augie Fackler)
Closed by commit rHG87047efbc6a6: debugcommands: create new 
debugantivirusrunning command (authored by durin42).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8353?vs=21426=21955

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

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

AFFECTED FILES
  mercurial/debugcommands.py
  tests/test-completion.t
  tests/test-help.t

CHANGE DETAILS

diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -971,6 +971,8 @@
   
debugancestor
  find the ancestor revision of two revisions in a given index
+   debugantivirusrunning
+ attempt to trigger an antivirus scanner to see if one is 
active
debugapplystreamclonebundle
  apply a stream clone bundle file
debugbackupbundle
diff --git a/tests/test-completion.t b/tests/test-completion.t
--- a/tests/test-completion.t
+++ b/tests/test-completion.t
@@ -74,6 +74,7 @@
 Show debug commands if there are no other candidates
   $ hg debugcomplete debug
   debugancestor
+  debugantivirusrunning
   debugapplystreamclonebundle
   debugbackupbundle
   debugbuilddag
@@ -261,6 +262,7 @@
   continue: dry-run
   copy: forget, after, at-rev, force, include, exclude, dry-run
   debugancestor: 
+  debugantivirusrunning: 
   debugapplystreamclonebundle: 
   debugbackupbundle: recover, patch, git, limit, no-merges, stat, graph, 
style, template
   debugbuilddag: mergeable-file, overwritten-file, new-file
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -127,6 +127,23 @@
 ui.write(b'%d:%s\n' % (r.rev(a), hex(a)))
 
 
+@command(b'debugantivirusrunning', [])
+def debugantivirusrunning(ui, repo):
+"""attempt to trigger an antivirus scanner to see if one is active"""
+with repo.cachevfs.open('eicar-test-file.com', b'wb') as f:
+f.write(
+util.b85decode(
+# This is a base85-armored version of the EICAR test file. See
+# https://en.wikipedia.org/wiki/EICAR_test_file for details.
+b'ST#=}P$fV?P+K%yP+C|uG$>GBDK|qyDK~v2MM*https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D8374: fuzz: tell manifest fuzzer about longer node hashes

2020-06-17 Thread durin42 (Augie Fackler)
Closed by commit rHG9bedcfb4bb0e: fuzz: tell manifest fuzzer about longer node 
hashes (authored by durin42).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Revision".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8374?vs=20977=21660

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

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

AFFECTED FILES
  contrib/fuzz/manifest.cc
  contrib/fuzz/manifest_corpus.py

CHANGE DETAILS

diff --git a/contrib/fuzz/manifest_corpus.py b/contrib/fuzz/manifest_corpus.py
--- a/contrib/fuzz/manifest_corpus.py
+++ b/contrib/fuzz/manifest_corpus.py
@@ -10,7 +10,7 @@
 with zipfile.ZipFile(args.out[0], "w", zipfile.ZIP_STORED) as zf:
 zf.writestr(
 "manifest_zero",
-'''PKG-INFO\09b3ed8f2b81095a13064402e930565f083346e9a
+'''\0PKG-INFO\09b3ed8f2b81095a13064402e930565f083346e9a
 README\080b6e76643dcb44d4bc729e932fc464b3e36dbe3
 hg\0b6444347c629cc058d478023905cfb83b7f5bb9d
 mercurial/__init__.py\0b80de5d138758541c5f05265ad144ab9fa86d1db
@@ -25,9 +25,14 @@
 tkmerge\03c922edb43a9c143682f7bc7b00f98b3c756ebe7
 ''',
 )
-zf.writestr("badmanifest_shorthashes", "narf\0aa\nnarf2\0aaa\n")
+zf.writestr("badmanifest_shorthashes", "\0narf\0aa\nnarf2\0aaa\n")
 zf.writestr(
 "badmanifest_nonull",
-"narf\0\n"
+"\0narf\0\n"
 "narf2\n",
 )
+
+zf.writestr(
+"manifest_long_nodes",
+
"\1a\0\n",
+)
diff --git a/contrib/fuzz/manifest.cc b/contrib/fuzz/manifest.cc
--- a/contrib/fuzz/manifest.cc
+++ b/contrib/fuzz/manifest.cc
@@ -3,6 +3,7 @@
 #include 
 #include 
 
+#include "FuzzedDataProvider.h"
 #include "pyutil.h"
 
 #include 
@@ -24,7 +25,7 @@
   lm[e]
   e in lm
   (e + 'nope') in lm
-  lm[b'xyzzy'] = (b'\0' * 20, 'x')
+  lm[b'xyzzy'] = (b'\0' * nlen, 'x')
   # do an insert, text should change
   assert lm.text() != mdata, "insert should change text and didn't: %r %r" % 
(lm.text(), mdata)
   cloned = lm.filtercopy(lambda x: x != 'xyzzy')
@@ -51,10 +52,14 @@
if (Size > 10) {
return 0;
}
+   FuzzedDataProvider provider(Data, Size);
+   Py_ssize_t nodelength = provider.ConsumeBool() ? 20 : 32;
+   PyObject *nlen = PyLong_FromSsize_t(nodelength);
PyObject *mtext =
PyBytes_FromStringAndSize((const char *)Data, (Py_ssize_t)Size);
PyObject *locals = PyDict_New();
PyDict_SetItemString(locals, "mdata", mtext);
+   PyDict_SetItemString(locals, "nlen", nlen);
PyObject *res = PyEval_EvalCode(code, contrib::pyglobals(), locals);
if (!res) {
PyErr_Print();



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


D8374: fuzz: tell manifest fuzzer about longer node hashes

2020-06-17 Thread durin42 (Augie Fackler)
durin42 added a comment.


  This is still valid.

REPOSITORY
  rHG Mercurial

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

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

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


D8636: pyutil: this has taken so long to fix, I'm using 3.8 now

2020-06-15 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/fuzz/pyutil.cc

CHANGE DETAILS

diff --git a/contrib/fuzz/pyutil.cc b/contrib/fuzz/pyutil.cc
--- a/contrib/fuzz/pyutil.cc
+++ b/contrib/fuzz/pyutil.cc
@@ -21,7 +21,7 @@
 void initpy(const char *cselfpath)
 {
 #ifdef HG_FUZZER_PY3
-   const std::string subdir = "/sanpy/lib/python3.7";
+   const std::string subdir = "/sanpy/lib/python3.8";
 #else
const std::string subdir = "/sanpy/lib/python2.7";
 #endif



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


D8637: fuzz: add config knob for PYTHON_CONFIG_FLAGS

2020-06-15 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I'll clean this up once we get oss-fuzz to use Python 3.8 instead of
  2.7, but for now we need a way to evolve the flags passed to
  python-config in lockstep with the Python version. Yuck.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/fuzz/Makefile

CHANGE DETAILS

diff --git a/contrib/fuzz/Makefile b/contrib/fuzz/Makefile
--- a/contrib/fuzz/Makefile
+++ b/contrib/fuzz/Makefile
@@ -11,6 +11,7 @@
 LIB_FUZZING_ENGINE ?= standalone_fuzz_target_runner.o
 
 PYTHON_CONFIG ?= $$OUT/sanpy/bin/python-config
+PYTHON_CONFIG_FLAGS ?= --ldflags
 
 CXXFLAGS += -Wno-deprecated-register
 
@@ -67,7 +68,7 @@
  -Wno-register -Wno-macro-redefined \
  -I../../mercurial dirs.cc \
  pyutil.o $(PARSERS_OBJS) \
- $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
+ $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) $(PYTHON_CONFIG_FLAGS)` \
  -o $$OUT/dirs_fuzzer
 
 fncache_fuzzer: fncache.cc 
@@ -75,7 +76,7 @@
  -Wno-register -Wno-macro-redefined \
  -I../../mercurial fncache.cc \
  pyutil.o $(PARSERS_OBJS) \
- $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
+ $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) $(PYTHON_CONFIG_FLAGS)` \
  -o $$OUT/fncache_fuzzer
 
 jsonescapeu8fast_fuzzer: jsonescapeu8fast.cc pyutil.o $(PARSERS_OBJS)
@@ -83,7 +84,7 @@
  -Wno-register -Wno-macro-redefined \
  -I../../mercurial jsonescapeu8fast.cc \
  pyutil.o $(PARSERS_OBJS) \
- $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
+ $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) $(PYTHON_CONFIG_FLAGS)` \
  -o $$OUT/jsonescapeu8fast_fuzzer
 
 manifest_fuzzer: manifest.cc pyutil.o $(PARSERS_OBJS) 
$$OUT/manifest_fuzzer_seed_corpus.zip
@@ -91,7 +92,7 @@
  -Wno-register -Wno-macro-redefined \
  -I../../mercurial manifest.cc \
  pyutil.o $(PARSERS_OBJS) \
- $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
+ $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) $(PYTHON_CONFIG_FLAGS)` \
  -o $$OUT/manifest_fuzzer
 
 revlog_fuzzer: revlog.cc pyutil.o $(PARSERS_OBJS) 
$$OUT/revlog_fuzzer_seed_corpus.zip
@@ -99,7 +100,7 @@
  -Wno-register -Wno-macro-redefined \
  -I../../mercurial revlog.cc \
  pyutil.o $(PARSERS_OBJS) \
- $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
+ $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) $(PYTHON_CONFIG_FLAGS)` \
  -o $$OUT/revlog_fuzzer
 
 dirstate_fuzzer: dirstate.cc pyutil.o $(PARSERS_OBJS) 
$$OUT/dirstate_fuzzer_seed_corpus.zip
@@ -107,7 +108,7 @@
  -Wno-register -Wno-macro-redefined \
  -I../../mercurial dirstate.cc \
  pyutil.o $(PARSERS_OBJS) \
- $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
+ $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) $(PYTHON_CONFIG_FLAGS)` \
  -o $$OUT/dirstate_fuzzer
 
 fm1readmarkers_fuzzer: fm1readmarkers.cc pyutil.o $(PARSERS_OBJS) 
$$OUT/fm1readmarkers_fuzzer_seed_corpus.zip
@@ -115,7 +116,7 @@
  -Wno-register -Wno-macro-redefined \
  -I../../mercurial fm1readmarkers.cc \
  pyutil.o $(PARSERS_OBJS) \
- $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
+ $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) $(PYTHON_CONFIG_FLAGS)` \
  -o $$OUT/fm1readmarkers_fuzzer
 
 clean:



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


D8626: memctx: add mergestate method

2020-06-11 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -2879,6 +2879,9 @@
 
 return scmutil.status(modified, added, removed, [], [], [], [])
 
+def mergestate(self):
+return mergestatemod.memmergestate(self._repo, self)
+
 
 class memfilectx(committablefilectx):
 """memfilectx represents an in-memory file to commit.



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


D8353: debugcommands: create new debugantivirusrunning command

2020-06-10 Thread durin42 (Augie Fackler)
durin42 added a comment.


  Sadly  I have no idea on that.

REPOSITORY
  rHG Mercurial

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

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

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


D8625: git: add debug logging when there's a mismatch in the cached heads list

2020-06-09 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The dag rebuild can be expensive, so let's try and avoid bugs where it
  transparently rebuilds all the time for no reason. This would have
  prevented the issue fixed in D8622 .

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/git/__init__.py
  hgext/git/gitlog.py
  hgext/git/index.py
  tests/test-git-interop.t

CHANGE DETAILS

diff --git a/tests/test-git-interop.t b/tests/test-git-interop.t
--- a/tests/test-git-interop.t
+++ b/tests/test-git-interop.t
@@ -36,8 +36,12 @@
   $ cd ..
 
 Now globally enable extension for the rest of the test:
-  $ echo "[extensions]" >> $HGRCPATH
-  > echo "git=" >> $HGRCPATH
+  $ cat <> $HGRCPATH
+  > [extensions]
+  > git=
+  > [git]
+  > log-index-cache-miss = yes
+  > EOF
 
 Make a new repo with git:
   $ mkdir foo
@@ -68,11 +72,14 @@
 But if you run hg init --git, it works:
   $ hg init --git
   $ hg id --traceback
+  heads mismatch, rebuilding dagcache
   3d9be8deba43 tip master
   $ hg status
+  heads mismatch, rebuilding dagcache
   ? gamma
 Log works too:
   $ hg log
+  heads mismatch, rebuilding dagcache
   changeset:   1:3d9be8deba43
   bookmark:master
   tag: tip
@@ -89,7 +96,8 @@
 
 and bookmarks:
   $ hg bookmarks
-   * master1:3d9be8deba43
+   * masterheads mismatch, rebuilding dagcache
+  1:3d9be8deba43
 
 diff even works transparently in both systems:
   $ echo blah >> alpha
@@ -102,6 +110,7 @@
alpha
   +blah
   $ hg diff --git
+  heads mismatch, rebuilding dagcache
   diff --git a/alpha b/alpha
   --- a/alpha
   +++ b/alpha
@@ -112,12 +121,15 @@
 Remove a file, it shows as such:
   $ rm alpha
   $ hg status
+  heads mismatch, rebuilding dagcache
   ! alpha
   ? gamma
 
 Revert works:
   $ hg revert alpha --traceback
+  heads mismatch, rebuilding dagcache
   $ hg status
+  heads mismatch, rebuilding dagcache
   ? gamma
   $ git status
   On branch master
@@ -130,6 +142,7 @@
 Add shows sanely in both:
   $ hg add gamma
   $ hg status
+  heads mismatch, rebuilding dagcache
   A gamma
   $ hg files
   alpha
@@ -148,7 +161,9 @@
 
 forget does what it should as well:
   $ hg forget gamma
+  heads mismatch, rebuilding dagcache
   $ hg status
+  heads mismatch, rebuilding dagcache
   ? gamma
   $ git status
   On branch master
@@ -165,11 +180,15 @@
 
   $ echo a >> alpha
   $ hg ci -m 'more alpha' --traceback --date '1583522787 18000'
+  heads mismatch, rebuilding dagcache
   $ echo b >> beta
   $ hg ci -m 'more beta'
+  heads mismatch, rebuilding dagcache
   $ echo a >> alpha
   $ hg ci -m 'even more alpha'
+  heads mismatch, rebuilding dagcache
   $ hg log -G alpha
+  heads mismatch, rebuilding dagcache
   @  changeset:   4:6626247b7dc8
   :  bookmark:master
   :  tag: tip
@@ -188,6 +207,7 @@
  summary: Add alpha
   
   $ hg log -G beta
+  heads mismatch, rebuilding dagcache
   o  changeset:   3:d8ee22687733
   :  user:test 
   :  date:Thu Jan 01 00:00:00 1970 +
@@ -200,15 +220,18 @@
   
 
   $ hg log -r "children(3d9be8deba43)" -T"{node|short} {children}\n"
+  heads mismatch, rebuilding dagcache
   a1983dd7fb19 3:d8ee22687733
 
 hg annotate
 
   $ hg annotate alpha
+  heads mismatch, rebuilding dagcache
   0: alpha
   2: a
   4: a
   $ hg annotate beta
+  heads mismatch, rebuilding dagcache
   1: beta
   3: b
 
@@ -219,6 +242,7 @@
   $ mkdir a
   $ echo "This is file mu." > a/mu
   $ hg ci -A -m 'Introduce file a/mu'
+  heads mismatch, rebuilding dagcache
   adding a/mu
 
 Both hg and git agree a/mu is part of the repo
@@ -238,10 +262,12 @@
   On branch master
   nothing to commit, working tree clean
   $ hg status
+  heads mismatch, rebuilding dagcache
 
 
 node|shortest works correctly
   $ hg log -T '{node}\n' | sort
+  heads mismatch, rebuilding dagcache
   3d9be8deba43482be2c81a4cb4be1f10d85fa8bc
   6626247b7dc8f231b183b8a4761c89139baca2ad
   a1983dd7fb19cbd83ad5a1c2fc8bf3d775dea12f
@@ -249,13 +275,16 @@
   c5864c9d16fb3431fe2c175ff84dc6accdbb2c18
   d8ee22687733a1991813560b15128cd9734f4b48
   $ hg log -r ae1ab744f95bfd5b07cf573baef98a778058537b --template 
"{shortest(node,1)}\n"
+  heads mismatch, rebuilding dagcache
   ae
 
 This coveres changelog.findmissing()
   $ hg merge --preview 3d9be8deba43
+  heads mismatch, rebuilding dagcache
 
 This covers manifest.diff()
   $ hg diff -c 3d9be8deba43
+  heads mismatch, rebuilding dagcache
   diff -r c5864c9d16fb -r 3d9be8deba43 beta
   --- /dev/nullThu Jan 01 00:00:00 1970 +
   +++ b/beta   Mon Jan 01 00:00:11 2007 +
diff --git a/hgext/git/index.py b/hgext/git/index.py
--- a/hgext/git/index.py
+++ b/hgext/git/index.py
@@ -216,7 +216,12 @@
 db.commit()
 
 
-def _index_repo(gitrepo, db, progress_factory=lambda *args, **kwargs: None):
+def _index_repo(

D8623: rebase: add environment variable to allow forcing in-memory rebase

2020-06-09 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: martinvonz.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Use it in a test case where we know the rebase should proceed without
  incident in-memory, so we can see tracebacks rather than fallbacks.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/rebase.py
  tests/test-copies-in-changeset.t

CHANGE DETAILS

diff --git a/tests/test-copies-in-changeset.t b/tests/test-copies-in-changeset.t
--- a/tests/test-copies-in-changeset.t
+++ b/tests/test-copies-in-changeset.t
@@ -356,7 +356,7 @@
   $ hg co -q 0
   $ hg mv a b
   $ hg ci -qm 'rename a to b'
-  $ hg rebase -d 1 --config rebase.experimental.inmemory=yes
+  $ HGNOREALLYONLYINMEMORYREBASE= hg rebase -d 1 --config 
rebase.experimental.inmemory=yes
   rebasing 2:* "rename a to b" (tip) (glob)
   merging a and b to b
   saved backup bundle to $TESTTMP/rebase-rename/.hg/strip-backup/*-*-rebase.hg 
(glob)
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1067,6 +1067,8 @@
 with ui.configoverride(overrides, b'rebase'):
 return _dorebase(ui, repo, action, opts, inmemory=inmemory)
 except error.InMemoryMergeConflictsError:
+if 'HGNOREALLYONLYINMEMORYREBASE' in os.environ:
+raise
 ui.warn(
 _(
 b'hit merge conflicts; re-running rebase without in-memory'



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


D8624: wip: this does not help but seems less wrong

2020-06-09 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/mergestate.py

CHANGE DETAILS

diff --git a/mercurial/mergestate.py b/mercurial/mergestate.py
--- a/mercurial/mergestate.py
+++ b/mercurial/mergestate.py
@@ -875,6 +875,7 @@
 self._basectx = ctx
 self.reset()
 self._ancestor_filectxs = {}
+self._state = {}
 
 def add(self, fcl, fco, fca, fd):
 """add a new (potentially?) conflicting file to the merge state"""
@@ -882,7 +883,9 @@
 # TODO(augie): the rebase codepath depends on non-implicit
 # ancestor. I think we should fix things so that ancestor can
 # be passed in to reset().
-self._ancestor_filectxs[fcl.path()] = fca
+print('paths', fcl.path(), fco.path(), fca.path(), fd)
+self._ancestor_filectxs[fd] = fca
+self._state[fd] = fcl, fco, fca
 
 # Since memmergestate isn't mutable yet, these are all trivial
 # implementations used by the "happy path" in merge code.
@@ -956,12 +959,13 @@
 fca = _filectxorabsent(
 nullhex if dfile not in actx else None, actx, dfile
 )
+fcl, fco, fca = self._state[dfile]
 fn = filemerge.premerge if preresolve else filemerge.filemerge
 complete, mergeret, deleted = fn(
 self._repo,
 wctx,
 self._local,
-dfile,  # orig
+fcl.path(),
 fcd,
 fco,
 fca,



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


D8353: debugcommands: create new debugantivirusrunning command

2020-06-09 Thread durin42 (Augie Fackler)
durin42 added a comment.


  Best guess (given I've never hit an AV problem) is that the AV engine would 
lose its lunch on the EICAR file and alert the user. I figure if the AV engine 
isn't picking up on it after 2 seconds then it's probably also not a 
performance issue for us.

REPOSITORY
  rHG Mercurial

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

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

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


D8592: filemerge: add __bytes__ for absentfilectx

2020-05-28 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This will at _least_ aid some upcoming debugging.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/filemerge.py

CHANGE DETAILS

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -98,6 +98,9 @@
 self._ctx = ctx
 self._f = f
 
+def __bytes__(self):
+return b'absent file %s@%s' % (self._f, self._ctx)
+
 def path(self):
 return self._f
 



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


D8591: mergestate: move staticmethod _filectxorabsent to module level

2020-05-28 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I suspect this was a static method just because it made merge.py feel
  less messy, but now we have a mergestate package so we can do better.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/mergestate.py

CHANGE DETAILS

diff --git a/mercurial/mergestate.py b/mercurial/mergestate.py
--- a/mercurial/mergestate.py
+++ b/mercurial/mergestate.py
@@ -30,6 +30,12 @@
 bits = bits[:-2] + bits[-1:]
 return b'\0'.join(bits)
 
+def _filectxorabsent(hexnode, ctx, f):
+if hexnode == nullhex:
+return filemerge.absentfilectx(ctx, f)
+else:
+return ctx[f]
+
 
 # Merge state record types. See ``mergestate`` docs for more.
 RECORD_LOCAL = b'L'
@@ -600,8 +606,8 @@
 actx = self._repo[anccommitnode]
 else:
 actx = None
-fcd = self._filectxorabsent(localkey, wctx, dfile)
-fco = self._filectxorabsent(onode, octx, ofile)
+fcd = _filectxorabsent(localkey, wctx, dfile)
+fco = _filectxorabsent(onode, octx, ofile)
 # TODO: move this to filectxorabsent
 fca = self._repo.filectx(afile, fileid=anode, changectx=actx)
 # "premerge" x flags
@@ -679,12 +685,6 @@
 
 return complete, r
 
-def _filectxorabsent(self, hexnode, ctx, f):
-if hexnode == nullhex:
-return filemerge.absentfilectx(ctx, f)
-else:
-return ctx[f]
-
 def preresolve(self, dfile, wctx):
 """run premerge process for dfile
 



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


D8590: githelp: add some minimal help for pickaxe functionality

2020-05-28 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Due to a conversation in work chat, I realized this is actually pretty
  well-hidden in Mercurial.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

CHANGE DETAILS

diff --git a/tests/test-githelp.t b/tests/test-githelp.t
--- a/tests/test-githelp.t
+++ b/tests/test-githelp.t
@@ -318,3 +318,10 @@
   hg journal --all
   
   note: in hg commits can be deleted from repo but we always have backups
+
+  $ hg githelp -- git log -Gnarf
+  hg grep --diff narf
+  $ hg githelp -- git log -S narf
+  hg grep --diff narf
+  $ hg githelp -- git log --pickaxe-regex narf
+  hg grep --diff narf
diff --git a/hgext/githelp.py b/hgext/githelp.py
--- a/hgext/githelp.py
+++ b/hgext/githelp.py
@@ -628,8 +628,17 @@
 (b'', b'stat', None, b''),
 (b'', b'graph', None, b''),
 (b'p', b'patch', None, b''),
+(b'G', b'grep-diff', b'', b''),
+(b'S', b'pickaxe-regex', b'', b''),
 ]
 args, opts = parseoptions(ui, cmdoptions, args)
+grep_pat = opts.get(b'grep_diff') or opts.get(b'pickaxe_regex')
+if grep_pat:
+cmd = Command(b'grep')
+cmd[b'--diff'] = grep_pat
+ui.status(b'%s\n' % bytes(cmd))
+return
+
 ui.status(
 _(
 b'note: -v prints the entire commit message like Git does. To '



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


D8572: merge: remove special case for in-memory merge

2020-05-19 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is now handled by the mergestate object, which knows if mergedriver 
works.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/merge.py

CHANGE DETAILS

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1367,10 +1367,6 @@
 usemergedriver = not overwrite and mergeactions and ms.mergedriver
 
 if usemergedriver:
-if wctx.isinmemory():
-raise error.InMemoryMergeConflictsError(
-b"in-memory merge does not support mergedriver"
-)
 ms.commit()
 proceed = driverpreprocess(repo, ms, wctx, labels=labels)
 # the driver might leave some files unresolved



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


D8566: cleanup: use mergestate.unresolvedcount() instead of bool(list(unresolved()))

2020-05-18 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This avoids some pointless copying.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/fix.py
  mercurial/commands.py
  mercurial/merge.py
  mercurial/mergeutil.py
  mercurial/shelve.py

CHANGE DETAILS

diff --git a/mercurial/shelve.py b/mercurial/shelve.py
--- a/mercurial/shelve.py
+++ b/mercurial/shelve.py
@@ -802,7 +802,7 @@
 with repo.lock():
 checkparents(repo, state)
 ms = repo[None].mergestate()
-if list(ms.unresolved()):
+if ms.unresolvedcount():
 raise error.Abort(
 _(b"unresolved conflicts, can't continue"),
 hint=_(b"see 'hg resolve', then 'hg unshelve --continue'"),
diff --git a/mercurial/mergeutil.py b/mercurial/mergeutil.py
--- a/mercurial/mergeutil.py
+++ b/mercurial/mergeutil.py
@@ -13,7 +13,7 @@
 
 
 def checkunresolved(ms):
-if list(ms.unresolved()):
+if ms.unresolvedcount():
 raise error.Abort(
 _(b"unresolved merge conflicts (see 'hg help resolve')")
 )
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1594,7 +1594,7 @@
 if len(pl) > 1:
 raise error.Abort(_(b"outstanding uncommitted merge"))
 ms = mergestatemod.mergestate.read(repo)
-if list(ms.unresolved()):
+if ms.unresolvedcount():
 raise error.Abort(
 _(b"outstanding merge conflicts"),
 hint=_(b"use 'hg resolve' to resolve"),
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -6176,12 +6176,12 @@
 return 1
 
 # Nudge users into finishing an unfinished operation
-unresolvedf = list(ms.unresolved())
+unresolvedc = ms.unresolvedcount()
 driverresolvedf = list(ms.driverresolved())
-if not unresolvedf and not driverresolvedf:
+if not unresolvedc and not driverresolvedf:
 ui.status(_(b'(no more unresolved files)\n'))
 cmdutil.checkafterresolved(repo)
-elif not unresolvedf:
+elif not unresolvedc:
 ui.status(
 _(
 b'(no more unresolved files -- '
diff --git a/hgext/fix.py b/hgext/fix.py
--- a/hgext/fix.py
+++ b/hgext/fix.py
@@ -426,7 +426,7 @@
 if not (len(revs) == 1 and wdirrev in revs):
 cmdutil.checkunfinished(repo)
 rewriteutil.precheck(repo, revs, b'fix')
-if wdirrev in revs and list(repo[wdirrev].mergestate().unresolved()):
+if wdirrev in revs and repo[wdirrev].mergestate().unresolvedcount():
 raise error.Abort(b'unresolved conflicts', hint=b"use 'hg resolve'")
 if not revs:
 raise error.Abort(



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


D8570: rebase: use context to load mergestate instead of loading it directly

2020-05-18 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: martinvonz.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -538,7 +538,7 @@
 user=ctx.user(),
 date=date,
 )
-mergestatemod.mergestate.clean(repo)
+self.wctx.mergestate(clean=True)
 else:
 newnode = commitnode(
 repo,



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


D8568: overlayworkingctx: implement mergestate() using in-memory mergestate

2020-05-18 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This will allow `hg fix` to use the mergestate() method without regressing.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -2520,6 +2520,7 @@
 return len(self._cache) == 0
 
 def clean(self):
+self._mergestate = None
 self._cache = {}
 
 def _compact(self):
@@ -2580,6 +2581,11 @@
 self._repo, path, parent=self, filelog=filelog
 )
 
+def mergestate(self, clean=False):
+if clean or self._mergestate is None:
+self._mergestate = mergestatemod.memmergestate(self._repo)
+return self._mergestate
+
 
 class overlayworkingfilectx(committablefilectx):
 """Wrap a ``workingfilectx`` but intercepts all writes into an in-memory



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


D8569: merge: get mergestate from context instead of directly

2020-05-18 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This causes `hg fix` (and probably others) to use the new in-memory mergestate
  object instead of the on-disk one, which may incidentally correct some
  defects.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/merge.py

CHANGE DETAILS

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1182,9 +1182,8 @@
 _prefetchfiles(repo, mctx, actions)
 
 updated, merged, removed = 0, 0, 0
-ms = mergestatemod.mergestate.clean(
-repo, wctx.p1().node(), mctx.node(), labels
-)
+ms = wctx.mergestate(clean=True)
+ms.reset(wctx.p1().node(), mctx.node(), labels)
 
 # add ACTION_GET_OTHER_AND_STORE to mergestate
 for e in actions[mergestatemod.ACTION_GET_OTHER_AND_STORE]:
@@ -1593,7 +1592,7 @@
 if not overwrite:
 if len(pl) > 1:
 raise error.Abort(_(b"outstanding uncommitted merge"))
-ms = mergestatemod.mergestate.read(repo)
+ms = wc.mergestate()
 if ms.unresolvedcount():
 raise error.Abort(
 _(b"outstanding merge conflicts"),



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


D8563: localrepo: get mergestate via context

2020-05-18 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -2466,7 +2466,7 @@
 ui.status(
 _(b'working directory now based on revision %d\n') % 
parents
 )
-mergestatemod.mergestate.clean(self, self[b'.'].node())
+self[None].mergestate(clean=True)
 
 # TODO: if we know which new heads may result from this rollback, pass
 # them to destroy(), which will prevent the branchhead cache from being
@@ -2865,7 +2865,7 @@
 fparent2 = nullid
 elif not fparentancestors:
 # TODO: this whole if-else might be simplified much more
-ms = mergestatemod.mergestate.read(self)
+ms = self[None].mergestate()
 if (
 fname in ms
 and ms[fname] == mergestatemod.MERGE_RECORD_MERGED_OTHER
@@ -2966,7 +2966,7 @@
 self, status, text, user, date, extra
 )
 
-ms = mergestatemod.mergestate.read(self)
+ms = self[None].mergestate()
 mergeutil.checkunresolved(ms)
 
 # internal config: ui.allowemptycommit



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


D8567: mergestate: implement trivial in-memory mergestate

2020-05-18 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is the dumbest possible "mergestate" implementation: it doesn't actually
  handle conflict storage in the slightest, but for the current in-memory merge
  cases it works great, and prevents us from accidentally touching .hg/merge
  while doing non-wdir operations.
  
  NOT DONE: this breaks tests in future changes in the series, currently getting
  stuck on the "premerge()" method in the mergestate object.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/mergestate.py

CHANGE DETAILS

diff --git a/mercurial/mergestate.py b/mercurial/mergestate.py
--- a/mercurial/mergestate.py
+++ b/mercurial/mergestate.py
@@ -85,7 +85,40 @@
 }
 
 
-class mergestate(object):
+class _basemergestate(object):
+def __init__(self, repo):
+self._repo = repo
+self._readmergedriver = None
+
+@util.propertycache
+def mergedriver(self):
+# protect against the following:
+# - A configures a malicious merge driver in their hgrc, then
+#   pauses the merge
+# - A edits their hgrc to remove references to the merge driver
+# - A gives a copy of their entire repo, including .hg, to B
+# - B inspects .hgrc and finds it to be clean
+# - B then continues the merge and the malicious merge driver
+#  gets invoked
+configmergedriver = self._repo.ui.config(
+b'experimental', b'mergedriver'
+)
+if (
+self._readmergedriver is not None
+and self._readmergedriver != configmergedriver
+):
+raise error.ConfigError(
+_(b"merge driver changed since merge started"),
+hint=_(b"revert merge driver change or abort merge"),
+)
+
+return configmergedriver
+
+def reset(self, node=None, other=None, labels=None):
+self._readmergedriver = None
+
+
+class mergestate(_basemergestate):
 '''track 3-way merge state of individual files
 
 The merge state is stored on disk when needed. Two files are used: one with
@@ -154,11 +187,12 @@
 """Initialize the merge state.
 
 Do not use this directly! Instead call read() or clean()."""
-self._repo = repo
+super(mergestate, self).__init__(repo)
 self._dirty = False
 self._labels = None
 
 def reset(self, node=None, other=None, labels=None):
+super(mergestate, self).reset(node=node, other=other, labels=labels)
 self._state = {}
 self._stateextras = {}
 self._local = None
@@ -170,7 +204,6 @@
 if node:
 self._local = node
 self._other = other
-self._readmergedriver = None
 if self.mergedriver:
 self._mdstate = MERGE_DRIVER_STATE_SUCCESS
 else:
@@ -355,30 +388,6 @@
 return records
 
 @util.propertycache
-def mergedriver(self):
-# protect against the following:
-# - A configures a malicious merge driver in their hgrc, then
-#   pauses the merge
-# - A edits their hgrc to remove references to the merge driver
-# - A gives a copy of their entire repo, including .hg, to B
-# - B inspects .hgrc and finds it to be clean
-# - B then continues the merge and the malicious merge driver
-#  gets invoked
-configmergedriver = self._repo.ui.config(
-b'experimental', b'mergedriver'
-)
-if (
-self._readmergedriver is not None
-and self._readmergedriver != configmergedriver
-):
-raise error.ConfigError(
-_(b"merge driver changed since merge started"),
-hint=_(b"revert merge driver change or abort merge"),
-)
-
-return configmergedriver
-
-@util.propertycache
 def local(self):
 if self._local is None:
 msg = b"local accessed but self._local isn't set"
@@ -857,3 +866,35 @@
 repo.dirstate.copy(f0, f)
 else:
 repo.dirstate.normal(f)
+
+
+class memmergestate(_basemergestate):
+def __init__(self, repo):
+super(memmergestate, self).__init__(repo)
+self.reset()
+
+def add(self, fcl, fco, fca, fd):
+"""add a new (potentially?) conflicting file to the merge state"""
+self._conflicts.add(fcl.path())
+
+# Since memmergestate isn't mutable yet, these are all trivial
+# implementations used by the "happy path" in merge code.
+def reset(self, node=None, other=None, labels=None):
+super(memmergestate, self).reset(node=node, other=other, labels=labels)
+self._conflicts = set()
+
+def commit(self):
+if self._conflicts:
+error.InMemoryMergeConflictsError(
+'cannot commit memmergestate 

D8565: mergestate: optimize unresolvedcount() a little bit

2020-05-18 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  It struck me as wasteful to make this extra list copy of a generator. I was
  hoping to manage to return a bool instead of an int (and thus avoid traversing
  the dictionary past the first unresolved entry) but at least one caller cares
  about the count and this is the easy way forward while still making me
  marginally happier.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/mergestate.py

CHANGE DETAILS

diff --git a/mercurial/mergestate.py b/mercurial/mergestate.py
--- a/mercurial/mergestate.py
+++ b/mercurial/mergestate.py
@@ -79,6 +79,12 @@
 ACTION_GET_OTHER_AND_STORE = b'gs'
 
 
+_MERGE_UNRESOLVED_STATES = {
+MERGE_RECORD_UNRESOLVED,
+MERGE_RECORD_UNRESOLVED_PATH,
+}
+
+
 class mergestate(object):
 '''track 3-way merge state of individual files
 
@@ -569,10 +575,7 @@
 """Obtain the paths of unresolved files."""
 
 for f, entry in pycompat.iteritems(self._state):
-if entry[0] in (
-MERGE_RECORD_UNRESOLVED,
-MERGE_RECORD_UNRESOLVED_PATH,
-):
+if entry[0] in _MERGE_UNRESOLVED_STATES:
 yield f
 
 def driverresolved(self):
@@ -713,7 +716,13 @@
 
 def unresolvedcount(self):
 """get unresolved count for this merge (persistent)"""
-return len(list(self.unresolved()))
+return len(
+[
+None
+for entry in pycompat.itervalues(self._state)
+if entry[0] in _MERGE_UNRESOLVED_STATES
+]
+)
 
 def actions(self):
 """return lists of actions to perform on the dirstate"""



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


  1   2   3   4   5   6   7   8   9   10   >