D6776: bookmarks: validate changes on push (issue6193) (BC)

2020-08-06 Thread mjacob (Manuel Jacob)
mjacob added a comment.


  I agree (with some previous answers) that adding more stuff to `--force` 
should be avoided.
  
  I planned to send a proposal (and patches) after the 5.5 release for adding 
more detailed options that can be used instead of `--force`. However, due to 
unexpected reasons, I don’t know whether I’ll have the time for doing that.

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

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

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


D8905: templater: add exception-raising version of open_template()

2020-08-06 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I'm about to add another caller of `open_template()` (in the template
  loader). That caller will want to get exceptions instead of `(None,
  None)` if the template doesn't exist. This patch therefore changes
  `open_template()` to raise exceptions and adds a new
  `try_open_template()` that returns the `(None, None)` value.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/debugcommands.py
  mercurial/formatter.py
  mercurial/hgweb/hgweb_mod.py
  mercurial/logcmdutil.py
  mercurial/templater.py

CHANGE DETAILS

diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -1095,17 +1095,18 @@
 templatepath = templatedir()
 if templatepath is not None or os.path.isabs(name):
 f = os.path.join(templatepath, name)
-try:
-return f, open(f, mode='rb')
-except EnvironmentError:
-return None, None
+return f, open(f, mode='rb')
 else:
 name_parts = pycompat.sysstr(name).split('/')
 package_name = '.'.join(['mercurial', 'templates'] + name_parts[:-1])
-try:
-return (
-name,
-resourceutil.open_resource(package_name, name_parts[-1]),
-)
-except (ImportError, OSError):
-return None, None
+return (
+name,
+resourceutil.open_resource(package_name, name_parts[-1]),
+)
+
+
+def try_open_template(name, templatepath=None):
+try:
+return open_template(name, templatepath)
+except (EnvironmentError, ImportError):
+return None, None
diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py
--- a/mercurial/logcmdutil.py
+++ b/mercurial/logcmdutil.py
@@ -628,9 +628,9 @@
 mapfile = style
 fp = None
 if not os.path.split(mapfile)[0]:
-(mapname, fp) = templater.open_template(
+(mapname, fp) = templater.try_open_template(
 b'map-cmdline.' + mapfile
-) or templater.open_template(mapfile)
+) or templater.try_open_template(mapfile)
 if mapname:
 mapfile = mapname
 return formatter.mapfile_templatespec(b'changeset', mapfile, fp)
diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -78,7 +78,7 @@
 locations = (os.path.join(style, b'map'), b'map-' + style, b'map')
 
 for location in locations:
-mapfile, fp = templater.open_template(location, path)
+mapfile, fp = templater.try_open_template(location, path)
 if mapfile:
 return style, mapfile, fp
 
diff --git a/mercurial/formatter.py b/mercurial/formatter.py
--- a/mercurial/formatter.py
+++ b/mercurial/formatter.py
@@ -600,9 +600,9 @@
 
 # perhaps a stock style?
 if not os.path.split(tmpl)[0]:
-(mapname, fp) = templater.open_template(
+(mapname, fp) = templater.try_open_template(
 b'map-cmdline.' + tmpl
-) or templater.open_template(tmpl)
+) or templater.try_open_template(tmpl)
 if mapname:
 return mapfile_templatespec(topic, mapname, fp)
 
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -1672,7 +1672,7 @@
 fm.write(b'templatedirs', b'checking templates (%s)...\n', p or b'')
 fm.condwrite(not p, b'', _(b" no template directories found\n"))
 if p:
-(m, fp) = templater.open_template(b"map-cmdline.default")
+(m, fp) = templater.try_open_template(b"map-cmdline.default")
 if m:
 # template found, check if it is working
 err = None



To: 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


D8907: templater: teach template loader to use open_template() function

2020-08-06 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The template loader can apparently load templates from relative paths,
  so I needed to add that support to `open_template()`.
  
  This takes the number of failing tests with PyOxidizer from 54 to 34.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/templater.py

CHANGE DETAILS

diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -913,7 +913,8 @@
 """Get parsed tree for the given template name. Use a local cache."""
 if t not in self.cache:
 try:
-self.cache[t] = util.readfile(self._map[t])
+mapfile, fp = open_template(self._map[t])
+self.cache[t] = fp.read()
 except KeyError as inst:
 raise templateutil.TemplateNotFound(
 _(b'"%s" not in template map') % inst.args[0]
@@ -1092,7 +1093,7 @@
 will then be the relative path.
 '''
 # Does the name point directly to a map file?
-if os.path.isabs(name):
+if os.path.isfile(name) or os.path.isabs(name):
 return name, open(name, mode='rb')
 
 # Does the name point to a template in the provided templatepath, or



To: 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


D8906: templater: restructure open_template() a little to prepare for relative paths

2020-08-06 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I found that it was easier to add support for relative paths after
  this restructuring. It also made it easier to explain each case with a
  code comment (which I did).

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/templater.py

CHANGE DETAILS

diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -1091,18 +1091,25 @@
 will be read from the mercurial.templates package instead. The returned 
path
 will then be the relative path.
 '''
+# Does the name point directly to a map file?
+if os.path.isabs(name):
+return name, open(name, mode='rb')
+
+# Does the name point to a template in the provided templatepath, or
+# in mercurial/templates/ if no path was provided?
 if templatepath is None:
 templatepath = templatedir()
-if templatepath is not None or os.path.isabs(name):
+if templatepath is not None:
 f = os.path.join(templatepath, name)
 return f, open(f, mode='rb')
-else:
-name_parts = pycompat.sysstr(name).split('/')
-package_name = '.'.join(['mercurial', 'templates'] + name_parts[:-1])
-return (
-name,
-resourceutil.open_resource(package_name, name_parts[-1]),
-)
+
+# Otherwise try to read it using the resources API
+name_parts = pycompat.sysstr(name).split('/')
+package_name = '.'.join(['mercurial', 'templates'] + name_parts[:-1])
+return (
+name,
+resourceutil.open_resource(package_name, name_parts[-1]),
+)
 
 
 def try_open_template(name, templatepath=None):



To: 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


D6776: bookmarks: validate changes on push (issue6193) (BC)

2020-08-06 Thread idlsoft (Sandu Turcan)
idlsoft added a comment.


  As I
  
  In D6776#133068 , @marmoute 
wrote:
  
  > As @valentin.gatienbaron pointed out, the now avoid adding more semantic to 
bare `--force` with an associated `--force-bookmark` especially because we want 
to be able to select the bookmarks that get force pushed here.
  
  I've expressed my concerns about that earlier, but ultimately it's a debate 
for core maintainers, we'll use whatever they decide.
  Without a clear decision it didn't make much sense to modify the PR.
  I'm not sure if I'll have the bandwith to resume working on this, but glad to 
see it getting renewed attention.

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

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

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


D6776: bookmarks: validate changes on push (issue6193) (BC)

2020-08-06 Thread marmoute (Pierre-Yves David)
marmoute added a comment.


  As @valentin.gatienbaron pointed out, the now avoid adding more semantic to 
bare `--force` with an associated `--force-bookmark` especially because we want 
to be able to select the bookmarks that get force pushed here.

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

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

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


D8904: merge: drop commitinfo argument to applyupdates (API)

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

REVISION SUMMARY
  We now pass the mergeresult object and hence there is no need to have a 
separate
  commitinfo argument as the required info is present in mergeresult object.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -1339,22 +1339,13 @@
 
 
 def applyupdates(
-repo,
-mresult,
-wctx,
-mctx,
-overwrite,
-wantfiledata,
-labels=None,
-commitinfo=None,
+repo, mresult, wctx, mctx, overwrite, wantfiledata, labels=None,
 ):
 """apply the merge action list to the working directory
 
 mresult is a mergeresult object representing result of the merge
 wctx is the working copy context
 mctx is the context to be merged into the working copy
-commitinfo is a mapping of information which needs to be stored somewhere
-   (probably mergestate) so that it can be used at commit time.
 
 Return a tuple of (counts, filedata), where counts is a tuple
 (updated, merged, removed, unresolved) that describes how many
@@ -1369,10 +1360,7 @@
 repo, wctx.p1().node(), mctx.node(), labels
 )
 
-if commitinfo is None:
-commitinfo = {}
-
-for f, op in pycompat.iteritems(commitinfo):
+for f, op in pycompat.iteritems(mresult.commitinfo):
 # the other side of filenode was choosen while merging, store this in
 # mergestate so that it can be reused on commit
 if op == b'other':
@@ -2051,14 +2039,7 @@
 
 wantfiledata = updatedirstate and not branchmerge
 stats, getfiledata = applyupdates(
-repo,
-mresult,
-wc,
-p2,
-overwrite,
-wantfiledata,
-labels=labels,
-commitinfo=mresult.commitinfo,
+repo, mresult, wc, p2, overwrite, wantfiledata, labels=labels,
 )
 
 if updatedirstate:



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


D8903: merge: remove emptyactions() and use collections.defaultdict(list) instead

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

REVISION SUMMARY
  emptyactions() used to return a dict which was populated and passed into
  applyupdates(). However, with recent changes, we no longer pass a plain dict,
  instead we pass the mergeresult object.
  
  There was only one usage of emptyactions and that too inside mergeresult 
object.
  That usage is replaced with collections.defaultdict(list) instead.
  
  Not sure why we were not using collections.defaultdict(list) from the 
beginning.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/largefiles/overrides.py
  mercurial/merge.py

CHANGE DETAILS

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -687,7 +687,7 @@
 def actionsdict(self):
 """ returns a dictionary of actions to be perfomed with action as key
 and a list of files and related arguments as values """
-res = emptyactions()
+res = collections.defaultdict(list)
 for a, d in pycompat.iteritems(self._actionmapping):
 for f, (args, msg) in pycompat.iteritems(d):
 res[a].append((f, args, msg))
@@ -1338,29 +1338,6 @@
 )
 
 
-def emptyactions():
-"""create an actions dict, to be populated and passed to applyupdates()"""
-return {
-m: []
-for m in (
-mergestatemod.ACTION_ADD,
-mergestatemod.ACTION_ADD_MODIFIED,
-mergestatemod.ACTION_FORGET,
-mergestatemod.ACTION_GET,
-mergestatemod.ACTION_CHANGED_DELETED,
-mergestatemod.ACTION_DELETED_CHANGED,
-mergestatemod.ACTION_REMOVE,
-mergestatemod.ACTION_DIR_RENAME_MOVE_LOCAL,
-mergestatemod.ACTION_LOCAL_DIR_RENAME_GET,
-mergestatemod.ACTION_MERGE,
-mergestatemod.ACTION_EXEC,
-mergestatemod.ACTION_KEEP,
-mergestatemod.ACTION_PATH_CONFLICT,
-mergestatemod.ACTION_PATH_CONFLICT_RESOLVE,
-)
-}
-
-
 def applyupdates(
 repo,
 mresult,
diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -497,14 +497,6 @@
 orig(ui, repo, *pats, **opts)
 
 
-# Register the MERGE_ACTION_LARGEFILE_MARK_REMOVED in emptyactions() return 
type
-@eh.wrapfunction(merge, b'emptyactions')
-def overrideemptyactions(origfn):
-ret = origfn()
-ret[MERGE_ACTION_LARGEFILE_MARK_REMOVED] = []
-return ret
-
-
 # Before starting the manifest merge, merge.updates will call
 # _checkunknownfile to check if there are any files in the merged-in
 # changeset that collide with unknown files in the working copy.



To: pulkit, #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 2 of 2] who: replace "Open Source Projects" with "projects"

2020-08-06 Thread Pierre-Yves David

Looks good to me.

On 7/26/20 5:06 AM, Manuel Jacob wrote:

# HG changeset patch
# User Manuel Jacob 
# Date 1595732734 -7200
#  Sun Jul 26 05:05:34 2020 +0200
# Node ID d53744ad71ed1abac574d6234494bca24da84e6a
# Parent  3ce49d42875b51d7bc953fc8a2cb47c8f7f3e91d
# EXP-Topic java_reference
who: replace "Open Source Projects" with "projects"

Facebook is not an open source project. (They open source some tools, but they
tend to be on GitHub.)

diff --git a/templates/who/index.html b/templates/who/index.html
--- a/templates/who/index.html
+++ b/templates/who/index.html
@@ -2,7 +2,7 @@
  
  {% block content %}

Who uses Mercurial
-   Mercurial is a free, distributed source control management tool. 
It is currently used by many Open Source Projects such as...
+   Mercurial is a free, distributed source control management tool. 
It is currently used by many projects such as...
  Facebook
  The social networking service Facebook https://code.facebook.com/posts/218678814984400/scaling-mercurial-at-facebook/;>chose 
Mercurial in 2014 due to its extensibility and the ability to make it work at scale.
  https://www.facebook.com;>https://www.facebook.com

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



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