D8976: registrar: fix a documentation typo

2020-09-01 Thread mharbison72 (Matt Harbison)
mharbison72 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/D8976

AFFECTED FILES
  mercurial/registrar.py

CHANGE DETAILS

diff --git a/mercurial/registrar.py b/mercurial/registrar.py
--- a/mercurial/registrar.py
+++ b/mercurial/registrar.py
@@ -121,7 +121,7 @@
 return self._docformat % (decl, doc)
 
 def _extrasetup(self, name, func):
-"""Execute exra setup for registered function, if needed
+"""Execute extra setup for registered function, if needed
 """
 
 



To: mharbison72, #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


Re: [PATCH stable] tests: fix test-demandimport.py on Python 3.9

2020-09-01 Thread Augie Fackler
queued for stable, thanks

> On Sep 1, 2020, at 19:32, Manuel Jacob  wrote:
> 
> # HG changeset patch
> # User Manuel Jacob 
> # Date 1599003056 -7200
> #  Wed Sep 02 01:30:56 2020 +0200
> # Branch stable
> # Node ID 386d7621b725560face484f963f2a96fead521d3
> # Parent  42202492a3b9aed0b2810560dfae1feb56a8bea4
> # EXP-Topic python3.9
> tests: fix test-demandimport.py on Python 3.9
> 
> Starting with Python 3.9, importing importlib.resources (indirectly) imports
> the zipfile module. Therefore, the module is not suitable for the test.
> Instead, we can use the ftplib module, which is very unlikely to be imported
> during the test run.
> 
> diff --git a/tests/test-demandimport.py b/tests/test-demandimport.py
> --- a/tests/test-demandimport.py
> +++ b/tests/test-demandimport.py
> @@ -232,7 +232,7 @@
> # Unlike the import statement, __import__() function should not raise
> # ImportError even if fromlist has an unknown item
> # (see Python/import.c:import_module_level() and ensure_fromlist())
> -assert 'zipfile' not in sys.modules
> -zipfileimp = __import__('zipfile', globals(), locals(), ['unknownattr'])
> -assert f(zipfileimp) == "", f(zipfileimp)
> +assert 'ftplib' not in sys.modules
> +zipfileimp = __import__('ftplib', globals(), locals(), ['unknownattr'])
> +assert f(zipfileimp) == "", f(zipfileimp)
> assert not util.safehasattr(zipfileimp, 'unknownattr')
> 
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

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


[PATCH stable] tests: fix test-demandimport.py on Python 3.9

2020-09-01 Thread Manuel Jacob
# HG changeset patch
# User Manuel Jacob 
# Date 1599003056 -7200
#  Wed Sep 02 01:30:56 2020 +0200
# Branch stable
# Node ID 386d7621b725560face484f963f2a96fead521d3
# Parent  42202492a3b9aed0b2810560dfae1feb56a8bea4
# EXP-Topic python3.9
tests: fix test-demandimport.py on Python 3.9

Starting with Python 3.9, importing importlib.resources (indirectly) imports
the zipfile module. Therefore, the module is not suitable for the test.
Instead, we can use the ftplib module, which is very unlikely to be imported
during the test run.

diff --git a/tests/test-demandimport.py b/tests/test-demandimport.py
--- a/tests/test-demandimport.py
+++ b/tests/test-demandimport.py
@@ -232,7 +232,7 @@
 # Unlike the import statement, __import__() function should not raise
 # ImportError even if fromlist has an unknown item
 # (see Python/import.c:import_module_level() and ensure_fromlist())
-assert 'zipfile' not in sys.modules
-zipfileimp = __import__('zipfile', globals(), locals(), ['unknownattr'])
-assert f(zipfileimp) == "", f(zipfileimp)
+assert 'ftplib' not in sys.modules
+zipfileimp = __import__('ftplib', globals(), locals(), ['unknownattr'])
+assert f(zipfileimp) == "", f(zipfileimp)
 assert not util.safehasattr(zipfileimp, 'unknownattr')

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


[Bug 6401] New: Add Python 3.9 to Python version options

2020-09-01 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=6401

Bug ID: 6401
   Summary: Add Python 3.9 to Python version options
   Product: Mercurial project
   Version: unspecified
  Hardware: All
OS: All
Status: UNCONFIRMED
  Severity: feature
  Priority: normal
 Component: infrastructure
  Assignee: bugzi...@mercurial-scm.org
  Reporter: z...@zash.se
CC: kbullock+mercur...@ringworld.org,
mercurial-devel@mercurial-scm.org

It currently goes to 3.8 and a build failure was reported on IRC by rom1dep
against 3.9

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


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


mercurial@45394: 2 new changesets (2 on stable)

2020-09-01 Thread Mercurial Commits
2 new changesets (2 on stable) in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/ce131084c976
changeset:   45393:ce131084c976
branch:  stable
parent:  45389:f62bb5d07848
user:Pulkit Goyal <7895pul...@gmail.com>
date:Tue Sep 01 16:27:18 2020 +0530
summary: Added tag 5.5.1 for changeset f62bb5d07848

https://www.mercurial-scm.org/repo/hg/rev/42202492a3b9
changeset:   45394:42202492a3b9
branch:  stable
tag: tip
user:Pulkit Goyal <7895pul...@gmail.com>
date:Tue Sep 01 16:27:25 2020 +0530
summary: Added signature for changeset f62bb5d07848

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


[PATCH 3 of 3] extdiff: move single file handling inside `not per-file` conditional

2020-09-01 Thread Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <7895pul...@gmail.com>
# Date 1598691918 -19800
#  Sat Aug 29 14:35:18 2020 +0530
# Node ID c1f593d4d608fe9180c3e7b2c4cb8eb179d1c468
# Parent  28e81de5f83624341454eea6ef5973cd7db10675
# EXP-Topic extdiff-refactor
extdiff: move single file handling inside `not per-file` conditional

If `--per-file` is passed, we will diffing files one by one, hence there is no
need to make this optimization around single file in that case. This
optimization is only required when `--per-file` is not passed and we will be
opening directory-diff for a single file.

Differential Revision: https://phab.mercurial-scm.org/D8971

diff --git a/hgext/extdiff.py b/hgext/extdiff.py
--- a/hgext/extdiff.py
+++ b/hgext/extdiff.py
@@ -456,23 +456,23 @@ def diffrevs(
 label1b = rev1b
 label2 = rev2
 
-# If only one change, diff the files instead of the directories
-# Handle bogus modifies correctly by checking if the files exist
-if len(common) == 1:
-common_file = util.localpath(common.pop())
-dir1a = os.path.join(tmproot, dir1a, common_file)
-label1a = common_file + rev1a
-if not os.path.isfile(dir1a):
-dir1a = pycompat.osdevnull
-if do3way:
-dir1b = os.path.join(tmproot, dir1b, common_file)
-label1b = common_file + rev1b
-if not os.path.isfile(dir1b):
-dir1b = pycompat.osdevnull
-dir2 = os.path.join(dir2root, dir2, common_file)
-label2 = common_file + rev2
+if not opts.get(b'per_file'):
+# If only one change, diff the files instead of the directories
+# Handle bogus modifies correctly by checking if the files exist
+if len(common) == 1:
+common_file = util.localpath(common.pop())
+dir1a = os.path.join(tmproot, dir1a, common_file)
+label1a = common_file + rev1a
+if not os.path.isfile(dir1a):
+dir1a = pycompat.osdevnull
+if do3way:
+dir1b = os.path.join(tmproot, dir1b, common_file)
+label1b = common_file + rev1b
+if not os.path.isfile(dir1b):
+dir1b = pycompat.osdevnull
+dir2 = os.path.join(dir2root, dir2, common_file)
+label2 = common_file + rev2
 
-if not opts.get(b'per_file'):
 # Run the external tool on the 2 temp directories or the patches
 cmdline = formatcmdline(
 cmdline,
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 3] extdiff: remove dir2root and pass full path as dir2 in _runperfilediff()

2020-09-01 Thread Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <7895pul...@gmail.com>
# Date 1598691746 -19800
#  Sat Aug 29 14:32:26 2020 +0530
# Node ID 28e81de5f83624341454eea6ef5973cd7db10675
# Parent  e49d6016a24ce0ead59e32db68489de6c18c779d
# EXP-Topic extdiff-refactor
extdiff: remove dir2root and pass full path as dir2 in _runperfilediff()

The only use of `dir2root` was to join with `dir2` to generate the path for
other side of diff. Like in previous patch, `dir1a` and `dir1b` are full paths
and no longer base names, hence we pass `dir2` as full path too and making
`dir2root` unrequired.

Differential Revision: https://phab.mercurial-scm.org/D8970

diff --git a/hgext/extdiff.py b/hgext/extdiff.py
--- a/hgext/extdiff.py
+++ b/hgext/extdiff.py
@@ -255,7 +255,6 @@ def _runperfilediff(
 tmproot,
 dir1a,
 dir1b,
-dir2root,
 dir2,
 rev1a,
 rev1b,
@@ -280,7 +279,7 @@ def _runperfilediff(
 if not os.path.isfile(path1b):
 path1b = pycompat.osdevnull
 
-path2 = os.path.join(dir2root, dir2, commonfile)
+path2 = os.path.join(dir2, commonfile)
 label2 = commonfile + rev2
 
 if confirm:
@@ -501,8 +500,7 @@ def diffrevs(
 tmproot=tmproot,
 dir1a=os.path.join(tmproot, dir1a),
 dir1b=os.path.join(tmproot, dir1b) if do3way else None,
-dir2root=dir2root,
-dir2=dir2,
+dir2=os.path.join(dir2root, dir2),
 rev1a=rev1a,
 rev1b=rev1b,
 rev2=rev2,
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 3] extdiff: pass full paths of `dir1a` and `dir1b` to `_runperfilediff()`

2020-09-01 Thread Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <7895pul...@gmail.com>
# Date 1598691514 -19800
#  Sat Aug 29 14:28:34 2020 +0530
# Node ID e49d6016a24ce0ead59e32db68489de6c18c779d
# Parent  c25efc468a4939682031d2a16a3c897cf59f0fb9
# EXP-Topic extdiff-refactor
extdiff: pass full paths of `dir1a` and `dir1b` to `_runperfilediff()`

Earlier we were passing basename instead of the fullpath and then joining with
the tmproot. This is wrong because the user can choose `rev1a` as wdir and in
those cases, tmproot should not be joined with the path.

I am working on refactoring extdiff logic so that we can have options like `diff
--tool` and encountered this. Although this patch in itself makes no difference,
however in future when a new caller of `_runperfilediff()` will be added, it
will be useful to directly pass on the full paths instead.

Differential Revision: https://phab.mercurial-scm.org/D8969

diff --git a/hgext/extdiff.py b/hgext/extdiff.py
--- a/hgext/extdiff.py
+++ b/hgext/extdiff.py
@@ -267,7 +267,7 @@ def _runperfilediff(
 waitprocs = []
 totalfiles = len(commonfiles)
 for idx, commonfile in enumerate(sorted(commonfiles)):
-path1a = os.path.join(tmproot, dir1a, commonfile)
+path1a = os.path.join(dir1a, commonfile)
 label1a = commonfile + rev1a
 if not os.path.isfile(path1a):
 path1a = pycompat.osdevnull
@@ -275,7 +275,7 @@ def _runperfilediff(
 path1b = b''
 label1b = b''
 if do3way:
-path1b = os.path.join(tmproot, dir1b, commonfile)
+path1b = os.path.join(dir1b, commonfile)
 label1b = commonfile + rev1b
 if not os.path.isfile(path1b):
 path1b = pycompat.osdevnull
@@ -499,8 +499,8 @@ def diffrevs(
 confirm=opts.get(b'confirm'),
 commonfiles=common,
 tmproot=tmproot,
-dir1a=dir1a,
-dir1b=dir1b,
+dir1a=os.path.join(tmproot, dir1a),
+dir1b=os.path.join(tmproot, dir1b) if do3way else None,
 dir2root=dir2root,
 dir2=dir2,
 rev1a=rev1a,
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D8974: merge: add `ACTION_KEEP_DELETED` to represent files we want to keep deleted

2020-09-01 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  There are files which were deleted/not present in working copy parent but were
  present on other side of merge. On merge, we might decide to keep them 
deleted.
  We want to track such cases more closely, rather all kind of cases which 
results
  from some kind of merging logic.
  
  We do have `ACTION_KEEP` but having a dedicated action for the deleted case is
  more cleaner.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/merge.py
  mercurial/mergestate.py
  mercurial/sparse.py

CHANGE DETAILS

diff --git a/mercurial/sparse.py b/mercurial/sparse.py
--- a/mercurial/sparse.py
+++ b/mercurial/sparse.py
@@ -399,7 +399,7 @@
 temporaryfiles.append(file)
 prunedactions[file] = action
 elif branchmerge:
-if type != mergestatemod.ACTION_KEEP:
+if type not in mergemod.mergeresult.NO_OP_ACTIONS:
 temporaryfiles.append(file)
 prunedactions[file] = action
 elif type == mergestatemod.ACTION_FORGET:
diff --git a/mercurial/mergestate.py b/mercurial/mergestate.py
--- a/mercurial/mergestate.py
+++ b/mercurial/mergestate.py
@@ -120,6 +120,7 @@
 ACTION_LOCAL_DIR_RENAME_GET = b'dg'
 ACTION_DIR_RENAME_MOVE_LOCAL = b'dm'
 ACTION_KEEP = b'k'
+ACTION_KEEP_DELETED = b'kd'
 ACTION_EXEC = b'e'
 ACTION_CREATED_MERGE = b'cm'
 
@@ -837,6 +838,10 @@
 for f, args, msg in actions.get(ACTION_KEEP, []):
 pass
 
+# keep deleted
+for f, args, msg in actions.get(ACTION_KEEP_DELETED, []):
+pass
+
 # get
 for f, args, msg in actions.get(ACTION_GET, []):
 if branchmerge:
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -523,7 +523,6 @@
 narrowed.
 """
 # TODO: handle with nonconflicttypes
-nooptypes = {mergestatemod.ACTION_KEEP}
 nonconflicttypes = {
 mergestatemod.ACTION_ADD,
 mergestatemod.ACTION_ADD_MODIFIED,
@@ -541,7 +540,7 @@
 pass
 elif not branchmerge:
 mresult.removefile(f)  # just updating, ignore changes outside 
clone
-elif action[0] in nooptypes:
+elif action[0] in mergeresult.NO_OP_ACTIONS:
 mresult.removefile(f)  # merge does not affect file
 elif action[0] in nonconflicttypes:
 raise error.Abort(
@@ -564,6 +563,11 @@
 It has information about what actions need to be performed on dirstate
 mapping of divergent renames and other such cases. '''
 
+NO_OP_ACTIONS = (
+mergestatemod.ACTION_KEEP,
+mergestatemod.ACTION_KEEP_DELETED,
+)
+
 def __init__(self):
 """
 filemapping: dict of filename as keys and action related info as values
@@ -711,12 +715,12 @@
 a
 not in (
 mergestatemod.ACTION_GET,
-mergestatemod.ACTION_KEEP,
 mergestatemod.ACTION_EXEC,
 mergestatemod.ACTION_REMOVE,
 mergestatemod.ACTION_PATH_CONFLICT_RESOLVE,
 )
 and self._actionmapping[a]
+and a not in self.NO_OP_ACTIONS
 ):
 return True
 
@@ -1167,6 +1171,11 @@
 repo.ui.note(_(b" %s: picking 'keep' action\n") % f)
 mresult.addfile(f, *bids[mergestatemod.ACTION_KEEP][0])
 continue
+# If keep deleted is an option, just do that
+if mergestatemod.ACTION_KEEP_DELETED in bids:
+repo.ui.note(_(b" %s: picking 'keep deleted' action\n") % f)
+mresult.addfile(f, *bids[mergestatemod.ACTION_KEEP_DELETED][0])
+continue
 # If there are gets and they all agree [how could they not?], do 
it.
 if mergestatemod.ACTION_GET in bids:
 ga0 = bids[mergestatemod.ACTION_GET][0]
@@ -1412,7 +1421,7 @@
 wctx[f].audit()
 wctx[f].remove()
 
-numupdates = mresult.len() - mresult.len((mergestatemod.ACTION_KEEP,))
+numupdates = mresult.len() - mresult.len(mergeresult.NO_OP_ACTIONS)
 progress = repo.ui.makeprogress(
 _(b'updating'), unit=_(b'files'), total=numupdates
 )
@@ -1521,6 +1530,11 @@
 ):
 repo.ui.debug(b" %s: %s -> k\n" % (f, msg))
 # no progress
+for f, args, msg in mresult.getactions(
+(mergestatemod.ACTION_KEEP_DELETED,), sort=True
+):
+repo.ui.debug(b" %s: %s -> kd\n" % (f, msg))
+# no progress
 
 # directory rename, move local
 for f, args, msg in mresult.getactions(



To: pulkit, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org