D9203: dirstate-tree: simplify the control flow in the Node.insert method

2020-10-13 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  But explicitly with the special case early, laying out the various case become
  simpler.
  
  (The initial motivation was to make some future lifetime error simpler).

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/dirstate/dirstate_tree/node.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate/dirstate_tree/node.rs 
b/rust/hg-core/src/dirstate/dirstate_tree/node.rs
--- a/rust/hg-core/src/dirstate/dirstate_tree/node.rs
+++ b/rust/hg-core/src/dirstate/dirstate_tree/node.rs
@@ -60,43 +60,46 @@
 // Are we're modifying the current file ? Is the the end of the path ?
 let is_current_file = tail.is_empty() && head.is_empty();
 
-if let NodeKind::File(file) =  self.kind {
-if is_current_file {
-let new = Self {
-kind: NodeKind::File(File {
-entry: new_entry,
-..file.clone()
-}),
-};
-return InsertResult {
-did_insert: false,
-old_entry: Some(std::mem::replace(self, new)),
-};
-} else {
-match file.entry.state {
-// Only replace the current file with a directory if it's
-// marked as `Removed`
-EntryState::Removed => {
-self.kind = NodeKind::Directory(Directory {
-was_file: Some(Box::from(file.clone())),
-children: Default::default(),
-})
-}
-_ => {
-return Node::insert_in_file(
-file, new_entry, head, tail,
-)
-}
+// Potentially Replace the current file with a directory if it's marked
+// as `Removed`
+if !is_current_file {
+if let NodeKind::File(file) =  self.kind {
+if file.entry.state == EntryState::Removed {
+self.kind = NodeKind::Directory(Directory {
+was_file: Some(Box::from(file.clone())),
+children: Default::default(),
+})
 }
 }
 }
-
 match  self.kind {
 NodeKind::Directory(directory) => {
 Node::insert_in_directory(directory, new_entry, head, tail)
 }
-NodeKind::File(_) => {
-unreachable!("The file case has already been handled")
+NodeKind::File(file) => {
+if is_current_file {
+let new = Self {
+kind: NodeKind::File(File {
+entry: new_entry,
+..file.clone()
+}),
+};
+InsertResult {
+did_insert: false,
+old_entry: Some(std::mem::replace(self, new)),
+}
+} else {
+match file.entry.state {
+EntryState::Removed => {
+unreachable!("Removed file turning into a 
directory was dealt with earlier")
+}
+_ => {
+Node::insert_in_file(
+file, new_entry, head, tail,
+)
+}
+}
+}
 }
 }
 }



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


D9202: dirstate-tree: move a conditional in an explicit boolean

2020-10-13 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This will help readability a bit and make the next change simpler to read.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/dirstate/dirstate_tree/node.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate/dirstate_tree/node.rs 
b/rust/hg-core/src/dirstate/dirstate_tree/node.rs
--- a/rust/hg-core/src/dirstate/dirstate_tree/node.rs
+++ b/rust/hg-core/src/dirstate/dirstate_tree/node.rs
@@ -57,9 +57,11 @@
 let head = split.next().unwrap_or(b"");
 let tail = split.next().unwrap_or(b"");
 
+// Are we're modifying the current file ? Is the the end of the path ?
+let is_current_file = tail.is_empty() && head.is_empty();
+
 if let NodeKind::File(file) =  self.kind {
-if tail.is_empty() && head.is_empty() {
-// We're modifying the current file
+if is_current_file {
 let new = Self {
 kind: NodeKind::File(File {
 entry: new_entry,



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


D9201: rust: cleanup some white space in a dock

2020-10-13 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  They seems to have sneaked there somehow.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/dirstate/dirstate_tree/tree.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate/dirstate_tree/tree.rs 
b/rust/hg-core/src/dirstate/dirstate_tree/tree.rs
--- a/rust/hg-core/src/dirstate/dirstate_tree/tree.rs
+++ b/rust/hg-core/src/dirstate/dirstate_tree/tree.rs
@@ -37,7 +37,7 @@
 /// Only the first two items in this list are implemented as of this commit.
 ///
 /// [1]: https://www.mercurial-scm.org/wiki/DirsCachePlan
-///   
+///
 ///
 /// # Structure
 ///



To: marmoute, #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 website] Replace some subversion references by Git ones

2020-10-13 Thread Manuel Jacob

On 13/10/2020 18.05, Stephane Blondon wrote:

# HG changeset patch
# User "Stephane" 
# Date 1602604771 -7200
#  Tue Oct 13 17:59:31 2020 +0200
# Node ID ca9d6015a0f2c8365636da5511c58a747d45ae35
# Parent  0cd22a550a68d30896374193fb4bfd1405cec843
Replace some subversion references by Git ones

Fixes: #6396

diff -r 0cd22a550a68 -r ca9d6015a0f2 templates/about/index.html
--- a/templates/about/index.htmlMon Oct 12 17:07:26 2020 +0200
+++ b/templates/about/index.htmlTue Oct 13 17:59:31 2020 +0200
@@ -24,7 +24,7 @@
  
  Easy to use
  
-Mercurial sports a consistent command set in which most subversion users feel right at home. Potentially dangerous actions are available via extensions you need to enable, so the basic interface is easy to use, easy to learn and hard to break. The Quick Start should get you going in a just few minutes.

+Mercurial sports a consistent command set in which most Git users feel right at home. Potentially 
dangerous actions are available via extensions you need to enable, so the basic interface is easy to use, easy to 
learn and hard to break. The Quick Start should get you going in 
a just few minutes.


It seems to me like Mercurial’s command set followed Subversion’s 
command set, while Git’s command set is more different. Therefore, the 
change distorts the meaning of the sentence (similar in the sentence 
that is changed next in this patch).


The intention of this change is a good one. Nowadays, it makes more 
sense to compare to Git than to compare to Subversion. But 
unfortunately, this requires larger changes than just replacing 
"Subversion" with "Git".



  Open Source
  
diff -r 0cd22a550a68 -r ca9d6015a0f2 templates/guide/index.html

--- a/templates/guide/index.htmlMon Oct 12 17:07:26 2020 +0200
+++ b/templates/guide/index.htmlTue Oct 13 17:59:31 2020 +0200
@@ -16,7 +16,7 @@
  
  

  Note:
-This guide doesn't require any prior knowledge of version control systems (though 
subversion users will likely feel at home quite quickly). Basic command line 
abilities are helpful, because we'll use the command line client. 
+This guide doesn't require any prior knowledge of version control systems (though 
Git users will likely feel at home quite quickly). Basic command line abilities are 
helpful, because we'll use the command line client. 
  
  Basic workflows
  
diff -r 0cd22a550a68 -r ca9d6015a0f2 templates/quickstart/index.html

--- a/templates/quickstart/index.html   Mon Oct 12 17:07:26 2020 +0200
+++ b/templates/quickstart/index.html   Tue Oct 13 17:59:31 2020 +0200
@@ -53,21 +53,15 @@
  
  

  I you want more than this quick overview, please have a look at our longer practical guide. 
-Part 2: Understanding Mercurial in 6 steps
+Part 2: Understanding Mercurial in 5 steps
  Now we'll look at some of the basic concepts of Mercurial to get a better 
understanding of its internals: 
  
  
-Like in Subversion, history consists of a number of commits. They're
+Like in Git (or Subversion), history consists of a number of commits. 
They're
called changesets in Mercurial.
  
  

-Subversion requires a strict linear ordering of the commits and
-  gives nice linear revision numbers to them. So revision N has only
-  one child revision, N+1. This is simple, but it requires a central server to 
make sure that
-  everybody agrees on the revision numbers.
-
-
-Mercurial generalizes this by letting each changeset have multiple
+Like Git, Mercurial uses a directed acyclic graph to order the changesets. 
So each changeset can have multiple
children. If I work alone and make commits I'll make

by making three commits. 
___
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 website] Replace some subversion references by Git ones

2020-10-13 Thread Stephane Blondon
# HG changeset patch
# User "Stephane" 
# Date 1602604771 -7200
#  Tue Oct 13 17:59:31 2020 +0200
# Node ID ca9d6015a0f2c8365636da5511c58a747d45ae35
# Parent  0cd22a550a68d30896374193fb4bfd1405cec843
Replace some subversion references by Git ones

Fixes: #6396

diff -r 0cd22a550a68 -r ca9d6015a0f2 templates/about/index.html
--- a/templates/about/index.htmlMon Oct 12 17:07:26 2020 +0200
+++ b/templates/about/index.htmlTue Oct 13 17:59:31 2020 +0200
@@ -24,7 +24,7 @@
 
 Easy to use
 
-Mercurial sports a consistent command set in which most subversion users 
feel right at home. Potentially dangerous actions are available via extensions 
you need to enable, so the basic interface is easy to use, easy to learn and 
hard to break. The Quick Start should get you going 
in a just few minutes.
+Mercurial sports a consistent command set in which most Git users feel 
right at home. Potentially dangerous actions are available via extensions you 
need to enable, so the basic interface is easy to use, easy to learn and hard 
to break. The Quick Start should get you going in a 
just few minutes.
 
 Open Source
 
diff -r 0cd22a550a68 -r ca9d6015a0f2 templates/guide/index.html
--- a/templates/guide/index.htmlMon Oct 12 17:07:26 2020 +0200
+++ b/templates/guide/index.htmlTue Oct 13 17:59:31 2020 +0200
@@ -16,7 +16,7 @@
 
 
 Note:
-This guide doesn't require any prior knowledge of version control systems 
(though subversion users will likely feel at home quite quickly). Basic command 
line abilities are helpful, because we'll use the command line client. 
+This guide doesn't require any prior knowledge of version control systems 
(though Git users will likely feel at home quite quickly). Basic command line 
abilities are helpful, because we'll use the command line client. 
 
 Basic workflows
 
diff -r 0cd22a550a68 -r ca9d6015a0f2 templates/quickstart/index.html
--- a/templates/quickstart/index.html   Mon Oct 12 17:07:26 2020 +0200
+++ b/templates/quickstart/index.html   Tue Oct 13 17:59:31 2020 +0200
@@ -53,21 +53,15 @@
 
 
 I you want more than this quick overview, please have a look at our longer 
practical guide. 
-Part 2: Understanding Mercurial in 6 steps
+Part 2: Understanding Mercurial in 5 steps
 Now we'll look at some of the basic concepts of Mercurial to get a better 
understanding of its internals: 
 
 
-Like in Subversion, history consists of a number of commits. They're
+Like in Git (or Subversion), history consists of a number of commits. 
They're
   called changesets in Mercurial.
 
 
-Subversion requires a strict linear ordering of the commits and
-  gives nice linear revision numbers to them. So revision N has only
-  one child revision, N+1. This is simple, but it requires a central server to 
make sure that
-  everybody agrees on the revision numbers.
-
-
-Mercurial generalizes this by letting each changeset have multiple
+Like Git, Mercurial uses a directed acyclic graph to order the changesets. 
So each changeset can have multiple
   children. If I work alone and make commits I'll make
   
   by making three commits. 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


mercurial@45677: new changeset

2020-10-13 Thread Mercurial Commits
New changeset in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/bdd2cdf9e248
changeset:   45677:bdd2cdf9e248
bookmark:@
tag: tip
user:Martin von Zweigbergk 
date:Tue Oct 06 21:52:27 2020 -0700
summary: errors: move UnknownCommand and AmbiguousCommand near CommandError

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


Re: [PATCH] mergestate: document `o` merge record state in _mergestate_base docs

2020-10-13 Thread Yuya Nishihara
On Tue, 13 Oct 2020 13:05:02 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pul...@gmail.com>
> # Date 1601991694 -19800
> #  Tue Oct 06 19:11:34 2020 +0530
> # Node ID 8af18289942a8e747ff76e28e80f3c9e2b437f18
> # Parent  d1759b2e18889eb2f58e9d348f45d76af047ba08
> mergestate: document `o` merge record state in _mergestate_base docs
> 
> _mergestate_base documentation serves as a nice documentation for mergestate.
> This also documents known merge records and known merge record states.
> 
> I missed adding `o` state to it when I introduced it. Let's add it now.
> 
> Differential Revision: https://phab.mercurial-scm.org/D9156
> 
> diff --git a/mercurial/mergestate.py b/mercurial/mergestate.py
> --- a/mercurial/mergestate.py
> +++ b/mercurial/mergestate.py
> @@ -160,6 +160,7 @@ class _mergestate_base(object):
>  r: resolved conflict
>  pu: unresolved path conflict (file conflicts with directory)
>  pr: resolved path conflict
> +o: file was merged in favor of other parent of merge

Maybe better to say it is " (deprecated)"?
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 2 of 5] commit: refactor salvage calculation to a different function

2020-10-13 Thread Yuya Nishihara
On Tue, 13 Oct 2020 13:03:28 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pul...@gmail.com>
> # Date 1602314615 -19800
> #  Sat Oct 10 12:53:35 2020 +0530
> # Node ID d3df36bcf4a885038d5df6302f18008945ce48e7
> # Parent  ca34efec098e04ef39341ef181c038f4a4522148
> # EXP-Topic merge-newnode-final
> commit: refactor salvage calculation to a different function

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


Re: [PATCH 1 of 5] mergestate: make filename argument optional in _mergestate_base.extras()

2020-10-13 Thread Yuya Nishihara
On Tue, 13 Oct 2020 13:03:27 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pul...@gmail.com>
> # Date 1602313984 -19800
> #  Sat Oct 10 12:43:04 2020 +0530
> # Node ID ca34efec098e04ef39341ef181c038f4a4522148
> # Parent  64a9423450efb39d7f1bc5b6b2cca1efafb1870e
> # EXP-Topic merge-newnode-final
> mergestate: make filename argument optional in _mergestate_base.extras()

> diff --git a/mercurial/mergestate.py b/mercurial/mergestate.py
> --- a/mercurial/mergestate.py
> +++ b/mercurial/mergestate.py
> @@ -305,7 +305,12 @@ class _mergestate_base(object):
>  ):
>  yield f
>  
> -def extras(self, filename):
> +def extras(self, filename=None):
> +""" return extras stored with the mergestate
> +
> +if filename is passed, extras for that file is only returned """
> +if filename is None:
> +return self._stateextras
>  return self._stateextras[filename]

How about adding a separate function? I don't like this kind of overloads
because different return types typically mean the function will serve
differently.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D9199: upgrade: allow sidedata upgrade to modify revision flag

2020-10-13 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  In the process, we fix the lack of HAS_COPIES_INFO flag on upgrade, and test 
the
  results.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/metadata.py
  mercurial/revlog.py
  mercurial/upgrade.py
  tests/test-copies-chain-merge.t
  tests/testlib/ext-sidedata.py

CHANGE DETAILS

diff --git a/tests/testlib/ext-sidedata.py b/tests/testlib/ext-sidedata.py
--- a/tests/testlib/ext-sidedata.py
+++ b/tests/testlib/ext-sidedata.py
@@ -70,7 +70,7 @@
 # and sha2 hashes
 sha256 = hashlib.sha256(text).digest()
 update[sidedata.SD_TEST2] = struct.pack('>32s', sha256)
-return False, (), update
+return False, (), update, 0, 0
 
 return sidedatacompanion
 
diff --git a/tests/test-copies-chain-merge.t b/tests/test-copies-chain-merge.t
--- a/tests/test-copies-chain-merge.t
+++ b/tests/test-copies-chain-merge.t
@@ -1,4 +1,4 @@
-#testcases filelog compatibility sidedata
+#testcases filelog compatibility sidedata upgraded
 
 =
 Test Copy tracing for chain of copies involving merge
@@ -580,7 +580,7 @@
  commit time.
 
 
-#if filelog
+#if upgraded
   $ cat >> $HGRCPATH << EOF
   > [format]
   > exp-use-side-data = yes
@@ -608,7 +608,7 @@
 #endif
 
 
-#if no-compatibility
+#if no-compatibility no-filelog
 
   $ for rev in `hg log --rev 'all()' -T '{rev}\n'`; do
   > echo "# revision $rev #"
@@ -790,35 +790,6 @@
 
 #endif
 
-Downgrade to keep testing the filelog algorithm
-(This can be removed once we have an explicite "upgrade" tests case_
-
-#if filelog
-  $ cat >> $HGRCPATH << EOF
-  > [format]
-  > exp-use-side-data = no
-  > exp-use-copies-side-data-changeset = no
-  > EOF
-  $ hg debugformat -v
-  format-variant repo config default
-  fncache:yesyes yes
-  dotencode:  yesyes yes
-  generaldelta:   yesyes yes
-  sparserevlog:   yesyes yes
-  sidedata:   yes no  no
-  persistent-nodemap:  no no  no
-  copies-sdc: yes no  no
-  plain-cl-delta: yesyes yes
-  compression:* (glob)
-  compression-level:  default default default
-  $ hg debugupgraderepo --run --quiet
-  upgrade will perform the following actions:
-  
-  requirements
- preserved: * (glob)
- removed: exp-copies-sidedata-changeset, exp-sidedata-flag
-  
-#endif
 
 Test copy information chaining
 ==
diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -732,8 +732,8 @@
 def sidedatacompanion(rl, rev):
 rl = getattr(rl, '_revlog', rl)
 if rl.flags(rev) & revlog.REVIDX_SIDEDATA:
-return True, (), {}
-return False, (), {}
+return True, (), {}, 0, 0
+return False, (), {}, 0, 0
 
 elif requirements.COPIESSDC_REQUIREMENT in addedreqs:
 sidedatacompanion = metadata.getsidedataadder(srcrepo, dstrepo)
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1491,8 +1491,8 @@
 
 def lookup(self, id):
 """locate a node based on:
-- revision number or str(revision number)
-- nodeid or subset of hex nodeid
+- revision number or str(revision number)
+- nodeid or subset of hex nodeid
 """
 n = self._match(id)
 if n is not None:
@@ -1771,8 +1771,7 @@
 return rev - 1
 
 def issnapshot(self, rev):
-"""tells whether rev is a snapshot
-"""
+"""tells whether rev is a snapshot"""
 if not self._sparserevlog:
 return self.deltaparent(rev) == nullrev
 elif util.safehasattr(self.index, b'issnapshot'):
@@ -2043,8 +2042,7 @@
 self._chunkclear()
 
 def _nodeduplicatecallback(self, transaction, node):
-"""called when trying to add a node already stored.
-"""
+"""called when trying to add a node already stored."""
 
 def addrevision(
 self,
@@ -2705,14 +2703,16 @@
 
 (srcrevlog, rev)
 
-and return a triplet that control changes to sidedata content from the
+and return a quintet that control changes to sidedata content from the
 old revision to the new clone result:
 
-(dropall, filterout, update)
+(dropall, filterout, update, new_flags, dropped_flags)
 
 * if `dropall` is True, all sidedata should be dropped
 * `filterout` is a set of sidedata keys that should be dropped
 * `update` is a mapping of additionnal/new key -> value
+* new_flags is a bitfields of new flags that the 

D9200: copies: test for deleted copy info not overwriting unrelated ones

2020-10-13 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  See test documentation for details. This is yet another corner case for copy
  tracing.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/copies.py
  tests/test-copies-chain-merge.t

CHANGE DETAILS

diff --git a/tests/test-copies-chain-merge.t b/tests/test-copies-chain-merge.t
--- a/tests/test-copies-chain-merge.t
+++ b/tests/test-copies-chain-merge.t
@@ -571,6 +571,50 @@
 
   $ hg up null --quiet
 
+Merging a branch where a rename was deleted with a branch where the same file 
was renamed
+--
+
+Create a "conflicting" merge where `d` get removed on one branch before its
+rename information actually conflict with the other branch.
+
+(the copy information from the branch that was not deleted should win).
+
+  $ hg up 'desc("i-0")'
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg mv b d
+  $ hg ci -m "h-1: b -(move)-> d"
+  created new head
+
+  $ hg up 'desc("c-1")'
+  1 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ hg merge 'desc("h-1")'
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m "mCH-delete-before-conflict-m-0"
+
+  $ hg up 'desc("h-1")'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg merge 'desc("c-1")'
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m "mHC-delete-before-conflict-m-0"
+  created new head
+  $ hg log -G --rev 
'::(desc("mCH-delete-before-conflict-m")+desc("mHC-delete-before-conflict-m"))'
+  @36 mHC-delete-before-conflict-m-0
+  |\
+  +---o  35 mCH-delete-before-conflict-m-0
+  | |/
+  | o  34 h-1: b -(move)-> d
+  | |
+  o |  6 c-1 delete d
+  | |
+  o |  2 i-2: c -move-> d
+  | |
+  o |  1 i-1: a -move-> c
+  |/
+  o  0 i-0 initial commit: a b h
+  
+
 
 Test that sidedata computations during upgrades are correct
 ===
@@ -787,6 +831,20 @@
entry-0014 size 14
 '\x00\x00\x00\x01\x10\x00\x00\x00\x01\x00\x00\x00\x00d'
   salvaged   : d, ;
+  # revision 34 #
+  1 sidedata entries
+   entry-0014 size 24
+
'\x00\x00\x00\x02\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00bd'
+  removed: b, ;
+  addedp1: d, b;
+  # revision 35 #
+  1 sidedata entries
+   entry-0014 size 4
+'\x00\x00\x00\x00'
+  # revision 36 #
+  1 sidedata entries
+   entry-0014 size 4
+'\x00\x00\x00\x00'
 
 #endif
 
@@ -1451,3 +1509,51 @@
   A d
   $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mCB-revert-m-0")'
   $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBC-revert-m-0")'
+
+
+Merging a branch where a rename was deleted with a branch where the same file 
was renamed
+--
+
+Create a "conflicting" merge where `d` get removed on one branch before its
+rename information actually conflict with the other branch.
+
+(the copy information from the branch that was not deleted should win).
+
+  $ hg log -G --rev 
'::(desc("mCH-delete-before-conflict-m")+desc("mHC-delete-before-conflict-m"))'
+  @36 mHC-delete-before-conflict-m-0
+  |\
+  +---o  35 mCH-delete-before-conflict-m-0
+  | |/
+  | o  34 h-1: b -(move)-> d
+  | |
+  o |  6 c-1 delete d
+  | |
+  o |  2 i-2: c -move-> d
+  | |
+  o |  1 i-1: a -move-> c
+  |/
+  o  0 i-0 initial commit: a b h
+  
+
+  $ hg status --copies --rev 'desc("i-0")' --rev 
'desc("mCH-delete-before-conflict-m")'
+  A d
+b (no-compatibility !)
+  R a
+  R b
+  $ hg status --copies --rev 'desc("i-0")' --rev 
'desc("mHC-delete-before-conflict-m")'
+  A d
+b
+  R a
+  R b
+  $ hg status --copies --rev 'desc("c-1")' --rev 
'desc("mCH-delete-before-conflict-m")'
+  A d
+b
+  R b
+  $ hg status --copies --rev 'desc("c-1")' --rev 
'desc("mHC-delete-before-conflict-m")'
+  A d
+b
+  R b
+  $ hg status --copies --rev 'desc("h-1")' --rev 
'desc("mCH-delete-before-conflict-m")'
+  R a
+  $ hg status --copies --rev 'desc("h-1")' --rev 
'desc("mHC-delete-before-conflict-m")'
+  R a
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -400,7 +400,10 @@
 elif changes is not None and dest in changes.merged:
 minor[dest] = value
 elif not isancestor(new_tt, other_tt):
-minor[dest] = value
+if value[1] is not None:
+minor[dest] = value
+elif isancestor(other_tt, new_tt):
+minor[dest] = value
 
 
 def _revinfo_getter_extra(repo):




D9198: sidedata: return enough data to set the proper flag in the future

2020-10-13 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  If the revision has information relevant to copy tracing, we need to set a
  dedicated flag in revlog. Currently the upgrade process is failing to do so.
  Before we teach the upgrade process about flags, we make the information
  available where we will needs it.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/metadata.py

CHANGE DETAILS

diff --git a/mercurial/metadata.py b/mercurial/metadata.py
--- a/mercurial/metadata.py
+++ b/mercurial/metadata.py
@@ -798,7 +798,7 @@
 def _getsidedata(srcrepo, rev):
 ctx = srcrepo[rev]
 files = compute_all_files_changes(ctx)
-return encode_files_sidedata(files)
+return encode_files_sidedata(files), files.has_copies_info
 
 
 def getsidedataadder(srcrepo, destrepo):
@@ -876,18 +876,19 @@
 staging = {}
 
 def sidedata_companion(revlog, rev):
-sidedata = {}
+data = {}, False
 if util.safehasattr(revlog, b'filteredrevs'):  # this is a changelog
 # Is the data previously shelved ?
 sidedata = staging.pop(rev, None)
 if sidedata is None:
 # look at the queued result until we find the one we are lookig
 # for (shelve the other ones)
-r, sidedata = sidedataq.get()
+r, data = sidedataq.get()
 while r != rev:
-staging[r] = sidedata
+staging[r] = data
 r, sidedata = sidedataq.get()
 tokens.release()
+sidedataq, has_copies_info = data
 return False, (), sidedata
 
 return sidedata_companion
@@ -901,7 +902,7 @@
 def sidedatacompanion(revlog, rev):
 sidedata = {}
 if util.safehasattr(revlog, 'filteredrevs'):  # this is a changelog
-sidedata = _getsidedata(srcrepo, rev)
+sidedata, has_copies_info = _getsidedata(srcrepo, rev)
 return False, (), sidedata
 
 return sidedatacompanion



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


D9197: changing-files: add a shorthand property to check for copy relevant info

2020-10-13 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We are going to reuse this change in more place, so we factor it out first.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/changelog.py
  mercurial/metadata.py

CHANGE DETAILS

diff --git a/mercurial/metadata.py b/mercurial/metadata.py
--- a/mercurial/metadata.py
+++ b/mercurial/metadata.py
@@ -75,6 +75,16 @@
 and self.copied_from_p2 == other.copied_from_p2
 )
 
+@property
+def has_copies_info(self):
+return bool(
+self.removed
+or self.merged
+or self.salvaged
+or self.copied_from_p1
+or self.copied_from_p2
+)
+
 @util.propertycache
 def added(self):
 """files actively added in the changeset
@@ -244,8 +254,7 @@
 
 
 def _process_root(ctx):
-"""compute the appropriate changed files for a changeset with no parents
-"""
+"""compute the appropriate changed files for a changeset with no parents"""
 # Simple, there was nothing before it, so everything is added.
 md = ChangingFiles()
 manifest = ctx.manifest()
@@ -255,8 +264,7 @@
 
 
 def _process_linear(parent_ctx, children_ctx, parent=1):
-"""compute the appropriate changed files for a changeset with a single 
parent
-"""
+"""compute the appropriate changed files for a changeset with a single 
parent"""
 md = ChangingFiles()
 parent_manifest = parent_ctx.manifest()
 children_manifest = children_ctx.manifest()
@@ -505,8 +513,7 @@
 
 
 def computechangesetfilesadded(ctx):
-"""return the list of files added in a changeset
-"""
+"""return the list of files added in a changeset"""
 added = []
 for f in ctx.files():
 if not any(f in p for p in ctx.parents()):
@@ -570,8 +577,7 @@
 
 
 def computechangesetfilesremoved(ctx):
-"""return the list of files removed in a changeset
-"""
+"""return the list of files removed in a changeset"""
 removed = []
 for f in ctx.files():
 if f not in ctx:
@@ -583,8 +589,7 @@
 
 
 def computechangesetfilesmerged(ctx):
-"""return the list of files merged in a changeset
-"""
+"""return the list of files merged in a changeset"""
 merged = []
 if len(ctx.parents()) < 2:
 return merged
diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -91,8 +91,8 @@
 
 
 class appender(object):
-'''the changelog index must be updated last on disk, so we use this class
-to delay writes to it'''
+"""the changelog index must be updated last on disk, so we use this class
+to delay writes to it"""
 
 def __init__(self, vfs, name, mode, buf):
 self.data = buf
@@ -583,13 +583,7 @@
 flags = 0
 sidedata = None
 if self._copiesstorage == b'changeset-sidedata':
-if (
-files.removed
-or files.merged
-or files.salvaged
-or files.copied_from_p1
-or files.copied_from_p2
-):
+if files.has_copies_info:
 flags |= flagutil.REVIDX_HASCOPIESINFO
 sidedata = metadata.encode_files_sidedata(files)
 



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


D9196: test: move upgrade run and check earlier in test-copies-chain-merge

2020-10-13 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We are about to introduce an explicit case for copy tracing after a upgrade. 
So
  I am moving the code around beforehand for clarity.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-copies-chain-merge.t

CHANGE DETAILS

diff --git a/tests/test-copies-chain-merge.t b/tests/test-copies-chain-merge.t
--- a/tests/test-copies-chain-merge.t
+++ b/tests/test-copies-chain-merge.t
@@ -571,6 +571,255 @@
 
   $ hg up null --quiet
 
+
+Test that sidedata computations during upgrades are correct
+===
+
+We upgrade a repository that is not using sidedata (the filelog case) and
+ check that the same side data have been generated as if they were computed at
+ commit time.
+
+
+#if filelog
+  $ cat >> $HGRCPATH << EOF
+  > [format]
+  > exp-use-side-data = yes
+  > exp-use-copies-side-data-changeset = yes
+  > EOF
+  $ hg debugformat -v
+  format-variant repo config default
+  fncache:yesyes yes
+  dotencode:  yesyes yes
+  generaldelta:   yesyes yes
+  sparserevlog:   yesyes yes
+  sidedata:noyes  no
+  persistent-nodemap:  no no  no
+  copies-sdc:  noyes  no
+  plain-cl-delta: yesyes yes
+  compression:* (glob)
+  compression-level:  default default default
+  $ hg debugupgraderepo --run --quiet
+  upgrade will perform the following actions:
+  
+  requirements
+ preserved: * (glob)
+ added: exp-copies-sidedata-changeset, exp-sidedata-flag
+  
+#endif
+
+
+#if no-compatibility
+
+  $ for rev in `hg log --rev 'all()' -T '{rev}\n'`; do
+  > echo "# revision $rev #"
+  > hg debugsidedata -c -v -- $rev
+  > hg debugchangedfiles $rev
+  > done
+  # revision 0 #
+  1 sidedata entries
+   entry-0014 size 34
+
'\x00\x00\x00\x03\x04\x00\x00\x00\x01\x00\x00\x00\x00\x04\x00\x00\x00\x02\x00\x00\x00\x00\x04\x00\x00\x00\x03\x00\x00\x00\x00abh'
+  added  : a, ;
+  added  : b, ;
+  added  : h, ;
+  # revision 1 #
+  1 sidedata entries
+   entry-0014 size 24
+
'\x00\x00\x00\x02\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00ac'
+  removed: a, ;
+  addedp1: c, a;
+  # revision 2 #
+  1 sidedata entries
+   entry-0014 size 24
+
'\x00\x00\x00\x02\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00cd'
+  removed: c, ;
+  addedp1: d, c;
+  # revision 3 #
+  1 sidedata entries
+   entry-0014 size 24
+
'\x00\x00\x00\x02\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00de'
+  removed: d, ;
+  addedp1: e, d;
+  # revision 4 #
+  1 sidedata entries
+   entry-0014 size 24
+
'\x00\x00\x00\x02\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00ef'
+  removed: e, ;
+  addedp1: f, e;
+  # revision 5 #
+  1 sidedata entries
+   entry-0014 size 14
+'\x00\x00\x00\x01\x14\x00\x00\x00\x01\x00\x00\x00\x00b'
+  touched: b, ;
+  # revision 6 #
+  1 sidedata entries
+   entry-0014 size 14
+'\x00\x00\x00\x01\x0c\x00\x00\x00\x01\x00\x00\x00\x00d'
+  removed: d, ;
+  # revision 7 #
+  1 sidedata entries
+   entry-0014 size 14
+'\x00\x00\x00\x01\x0c\x00\x00\x00\x01\x00\x00\x00\x00d'
+  removed: d, ;
+  # revision 8 #
+  1 sidedata entries
+   entry-0014 size 14
+'\x00\x00\x00\x01\x04\x00\x00\x00\x01\x00\x00\x00\x00d'
+  added  : d, ;
+  # revision 9 #
+  1 sidedata entries
+   entry-0014 size 24
+
'\x00\x00\x00\x02\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00bg'
+  removed: b, ;
+  addedp1: g, b;
+  # revision 10 #
+  1 sidedata entries
+   entry-0014 size 24
+
'\x00\x00\x00\x02\x06\x00\x00\x00\x01\x00\x00\x00\x01\x0c\x00\x00\x00\x02\x00\x00\x00\x00fg'
+  addedp1: f, g;
+  removed: g, ;
+  # revision 11 #
+  1 sidedata entries
+   entry-0014 size 4
+'\x00\x00\x00\x00'
+  # revision 12 #
+  1 sidedata entries
+   entry-0014 size 4
+'\x00\x00\x00\x00'
+  # revision 13 #
+  1 sidedata entries
+   entry-0014 size 4
+'\x00\x00\x00\x00'
+  # revision 14 #
+  1 sidedata entries
+   entry-0014 size 14
+'\x00\x00\x00\x01\x04\x00\x00\x00\x01\x00\x00\x00\x00d'
+  added  : d, ;
+  # revision 15 #
+  1 sidedata entries
+   entry-0014 size 4
+'\x00\x00\x00\x00'
+  # revision 16 #
+  1 sidedata entries
+   entry-0014 size 14
+'\x00\x00\x00\x01\x04\x00\x00\x00\x01\x00\x00\x00\x00d'
+  added  : d, ;
+  # revision 17 #
+  1 sidedata entries
+   entry-0014 size 4
+'\x00\x00\x00\x00'
+  # revision 18 #
+  1 sidedata entries
+   entry-0014 size 4

D9195: copies: split creation of the graph and actual checking again

2020-10-13 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The re-install the old split. It will be necessary to test that the upgrade
  process produced a functionally identical result. It will be useful to detect
  case where the metadata we look at identical, but some other items we did not
  checked are missing.
  
  (spoiler: we will find some bug)

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-copies-chain-merge.t

CHANGE DETAILS

diff --git a/tests/test-copies-chain-merge.t b/tests/test-copies-chain-merge.t
--- a/tests/test-copies-chain-merge.t
+++ b/tests/test-copies-chain-merge.t
@@ -154,6 +154,12 @@
   o  0 i-0 initial commit: a b h
   
 
+Setup all merge
+===
+
+This is done beforehand to validate that the upgrade process creates valid copy
+information.
+
 merging with unrelated change does not interfere with the renames
 ---
 
@@ -191,6 +197,407 @@
   o  0 i-0 initial commit: a b h
   
 
+
+merging with the side having a delete
+-
+
+case summary:
+- one with change to an unrelated file
+- one deleting the change
+and recreate an unrelated file after the merge
+
+  $ hg up 'desc("b-1")'
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg merge 'desc("c-1")'
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m 'mBCm-0 simple merge - one way'
+  $ echo bar > d
+  $ hg add d
+  $ hg ci -m 'mBCm-1 re-add d'
+  $ hg up 'desc("c-1")'
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg merge 'desc("b-1")'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m 'mCBm-0 simple merge - the other way'
+  created new head
+  $ echo bar > d
+  $ hg add d
+  $ hg ci -m 'mCBm-1 re-add d'
+  $ hg log -G --rev '::(desc("mCBm")+desc("mBCm"))'
+  @  16 mCBm-1 re-add d
+  |
+  o15 mCBm-0 simple merge - the other way
+  |\
+  | | o  14 mBCm-1 re-add d
+  | | |
+  +---o  13 mBCm-0 simple merge - one way
+  | |/
+  | o  6 c-1 delete d
+  | |
+  o |  5 b-1: b update
+  |/
+  o  2 i-2: c -move-> d
+  |
+  o  1 i-1: a -move-> c
+  |
+  o  0 i-0 initial commit: a b h
+  
+
+Comparing with a merge re-adding the file afterward
+---
+
+Merge:
+- one with change to an unrelated file
+- one deleting and recreating the change
+
+  $ hg up 'desc("b-1")'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg merge 'desc("d-2")'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m 'mBDm-0 simple merge - one way'
+  $ hg up 'desc("d-2")'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg merge 'desc("b-1")'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m 'mDBm-0 simple merge - the other way'
+  created new head
+  $ hg log -G --rev '::(desc("mDBm")+desc("mBDm"))'
+  @18 mDBm-0 simple merge - the other way
+  |\
+  +---o  17 mBDm-0 simple merge - one way
+  | |/
+  | o  8 d-2 re-add d
+  | |
+  | o  7 d-1 delete d
+  | |
+  o |  5 b-1: b update
+  |/
+  o  2 i-2: c -move-> d
+  |
+  o  1 i-1: a -move-> c
+  |
+  o  0 i-0 initial commit: a b h
+  
+
+
+Comparing with a merge with colliding rename
+
+
+- the "e-" branch renaming b to f (through 'g')
+- the "a-" branch renaming d to f (through e)
+
+  $ hg up 'desc("a-2")'
+  2 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg merge 'desc("e-2")'
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m 'mAEm-0 simple merge - one way'
+  $ hg up 'desc("e-2")'
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg merge 'desc("a-2")'
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m 'mEAm-0 simple merge - the other way'
+  created new head
+  $ hg log -G --rev '::(desc("mAEm")+desc("mEAm"))'
+  @20 mEAm-0 simple merge - the other way
+  |\
+  +---o  19 mAEm-0 simple merge - one way
+  | |/
+  | o  10 e-2 g -move-> f
+  | |
+  | o  9 e-1 b -move-> g
+  | |
+  o |  4 a-2: e -move-> f
+  | |
+  o |  3 a-1: d -move-> e
+  |/
+  o  2 i-2: c -move-> d
+  |
+  o  1 i-1: a -move-> c
+  |
+  o  0 i-0 initial commit: a b h
+  
+
+
+Merge:
+- one with change to an unrelated file (b)
+- one overwriting a file (d) with a rename (from h to i to d)
+
+  $ hg up 'desc("i-2")'
+  2 files updated, 0 files merged, 1 files removed, 0 

mercurial@45676: 3 new changesets

2020-10-13 Thread Mercurial Commits
3 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/66cb7ad3787c
changeset:   45674:66cb7ad3787c
parent:  45673:7990e7d957b0
parent:  45657:4a146cff76fa
user:Martin von Zweigbergk 
date:Thu Oct 08 23:19:01 2020 -0700
summary: branching: merge with stable

https://www.mercurial-scm.org/repo/hg/rev/59ab71498bee
changeset:   45675:59ab71498bee
user:Aay Jay Chan 
date:Wed Oct 07 00:39:52 2020 +0800
summary: tests: test output of {predecessors}, {successorssets} for 
non-obsolete csets

https://www.mercurial-scm.org/repo/hg/rev/f95b23283760
changeset:   45676:f95b23283760
bookmark:@
tag: tip
user:Aay Jay Chan 
date:Wed Oct 07 00:45:41 2020 +0800
summary: templatekw: make {successorssets} always return a list (issue6342)

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


Re: [PATCH 1 of 6] grep: explicitly pass regexp to closure functions

2020-10-13 Thread Pulkit Goyal
On Wed, Oct 7, 2020 at 6:29 PM Yuya Nishihara  wrote:
>
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1599632246 -32400
> #  Wed Sep 09 15:17:26 2020 +0900
> # Node ID 44729154f2ab3152224b89bfc565a70f832ebc3a
> # Parent  d1759b2e18889eb2f58e9d348f45d76af047ba08
> grep: explicitly pass regexp to closure functions
>
> These functions will be extracted to new module.

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


Re: [PATCH V2] revset: fix sorting key of wdir revision

2020-10-13 Thread Pulkit Goyal
On Sat, Oct 10, 2020 at 7:35 AM Yuya Nishihara  wrote:
>
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1602238750 -32400
> #  Fri Oct 09 19:19:10 2020 +0900
> # Node ID 1ffc832a5390d73e844ff7f6e4cc05b168030fe0
> # Parent  17a12f53dd72d39ce62721a0a43b681d4b4b4bb8
> revset: fix sorting key of wdir revision
>
> It would go wrong on Python 2, and would crash on Python 3.

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


[PATCH] mergestate: document `o` merge record state in _mergestate_base docs

2020-10-13 Thread Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <7895pul...@gmail.com>
# Date 1601991694 -19800
#  Tue Oct 06 19:11:34 2020 +0530
# Node ID 8af18289942a8e747ff76e28e80f3c9e2b437f18
# Parent  d1759b2e18889eb2f58e9d348f45d76af047ba08
mergestate: document `o` merge record state in _mergestate_base docs

_mergestate_base documentation serves as a nice documentation for mergestate.
This also documents known merge records and known merge record states.

I missed adding `o` state to it when I introduced it. Let's add it now.

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

diff --git a/mercurial/mergestate.py b/mercurial/mergestate.py
--- a/mercurial/mergestate.py
+++ b/mercurial/mergestate.py
@@ -160,6 +160,7 @@ class _mergestate_base(object):
 r: resolved conflict
 pu: unresolved path conflict (file conflicts with directory)
 pr: resolved path conflict
+o: file was merged in favor of other parent of merge
 
 The resolve command transitions between 'u' and 'r' for conflicts and
 'pu' and 'pr' for path conflicts.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 5 of 5] commit: pass ChangingFiles object as argument to _process_files

2020-10-13 Thread Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <7895pul...@gmail.com>
# Date 1602316165 -19800
#  Sat Oct 10 13:19:25 2020 +0530
# Node ID 0f38f9c9c4c83caa269a9fcdf6ad2a17d52f14e9
# Parent  104b104df7d9515967b87135977f434fb3560431
# EXP-Topic merge-newnode-final
commit: pass ChangingFiles object as argument to _process_files

Instead of returning it, we pass it as an argument. This makes the whole if-else
in `_prepare_files` a bit simpler. Else each if-else branch was creating the
object.

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

diff --git a/mercurial/commit.py b/mercurial/commit.py
--- a/mercurial/commit.py
+++ b/mercurial/commit.py
@@ -114,14 +114,16 @@ def _prepare_files(tr, ctx, error=False,
 p1 = ctx.p1()
 
 writechangesetcopy, writefilecopymeta = _write_copy_meta(repo)
+files = metadata.ChangingFiles()
 ms = mergestate.mergestate.read(repo)
 salvaged = _get_salvaged(repo, ms, ctx)
+for s in salvaged:
+files.mark_salvaged(s)
 
 if ctx.manifestnode():
 # reuse an existing manifest revision
 repo.ui.debug(b'reusing known manifest\n')
 mn = ctx.manifestnode()
-files = metadata.ChangingFiles()
 files.update_touched(ctx.files())
 if writechangesetcopy:
 files.update_added(ctx.filesadded())
@@ -129,9 +131,8 @@ def _prepare_files(tr, ctx, error=False,
 elif not ctx.files():
 repo.ui.debug(b'reusing manifest from p1 (no file change)\n')
 mn = p1.manifestnode()
-files = metadata.ChangingFiles()
 else:
-mn, files = _process_files(tr, ctx, ms, error=error)
+mn = _process_files(tr, ctx, ms, files, error=error)
 
 if origctx and origctx.manifestnode() == mn:
 origfiles = origctx.files()
@@ -142,9 +143,6 @@ def _prepare_files(tr, ctx, error=False,
 files.update_copies_from_p1(ctx.p1copies())
 files.update_copies_from_p2(ctx.p2copies())
 
-for s in salvaged:
-files.mark_salvaged(s)
-
 return mn, files
 
 
@@ -165,7 +163,7 @@ def _get_salvaged(repo, ms, ctx):
 return salvaged
 
 
-def _process_files(tr, ctx, ms, error=False):
+def _process_files(tr, ctx, ms, files, error=False):
 repo = ctx.repo()
 p1 = ctx.p1()
 p2 = ctx.p2()
@@ -180,8 +178,6 @@ def _process_files(tr, ctx, ms, error=Fa
 m1 = m1ctx.read()
 m2 = m2ctx.read()
 
-files = metadata.ChangingFiles()
-
 # check in files
 added = []
 removed = list(ctx.removed())
@@ -231,7 +227,7 @@ def _process_files(tr, ctx, ms, error=Fa
 
 mn = _commit_manifest(tr, linkrev, ctx, mctx, m, files.touched, added, 
drop)
 
-return mn, files
+return mn
 
 
 def _filecommit(
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 4 of 5] commit: pass mergestate into `_process_files` instead of re-reading it

2020-10-13 Thread Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <7895pul...@gmail.com>
# Date 1602315920 -19800
#  Sat Oct 10 13:15:20 2020 +0530
# Node ID 104b104df7d9515967b87135977f434fb3560431
# Parent  236c4ba9f9b8603347026975a4fcb97da75ade8f
# EXP-Topic merge-newnode-final
commit: pass mergestate into `_process_files` instead of re-reading it

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

diff --git a/mercurial/commit.py b/mercurial/commit.py
--- a/mercurial/commit.py
+++ b/mercurial/commit.py
@@ -131,7 +131,7 @@ def _prepare_files(tr, ctx, error=False,
 mn = p1.manifestnode()
 files = metadata.ChangingFiles()
 else:
-mn, files = _process_files(tr, ctx, error=error)
+mn, files = _process_files(tr, ctx, ms, error=error)
 
 if origctx and origctx.manifestnode() == mn:
 origfiles = origctx.files()
@@ -165,7 +165,7 @@ def _get_salvaged(repo, ms, ctx):
 return salvaged
 
 
-def _process_files(tr, ctx, error=False):
+def _process_files(tr, ctx, ms, error=False):
 repo = ctx.repo()
 p1 = ctx.p1()
 p2 = ctx.p2()
@@ -179,7 +179,6 @@ def _process_files(tr, ctx, error=False)
 m = mctx.read()
 m1 = m1ctx.read()
 m2 = m2ctx.read()
-ms = mergestate.mergestate.read(repo)
 
 files = metadata.ChangingFiles()
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 3 of 5] commit: move salvaged calculation a bit earlier in the function

2020-10-13 Thread Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <7895pul...@gmail.com>
# Date 1602315731 -19800
#  Sat Oct 10 13:12:11 2020 +0530
# Node ID 236c4ba9f9b8603347026975a4fcb97da75ade8f
# Parent  d3df36bcf4a885038d5df6302f18008945ce48e7
# EXP-Topic merge-newnode-final
commit: move salvaged calculation a bit earlier in the function

This helps us initialize mergestate before and now we can pass it into
`_process_files()` instead of re-reading it there.

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

diff --git a/mercurial/commit.py b/mercurial/commit.py
--- a/mercurial/commit.py
+++ b/mercurial/commit.py
@@ -114,6 +114,8 @@ def _prepare_files(tr, ctx, error=False,
 p1 = ctx.p1()
 
 writechangesetcopy, writefilecopymeta = _write_copy_meta(repo)
+ms = mergestate.mergestate.read(repo)
+salvaged = _get_salvaged(repo, ms, ctx)
 
 if ctx.manifestnode():
 # reuse an existing manifest revision
@@ -140,8 +142,6 @@ def _prepare_files(tr, ctx, error=False,
 files.update_copies_from_p1(ctx.p1copies())
 files.update_copies_from_p2(ctx.p2copies())
 
-ms = mergestate.mergestate.read(repo)
-salvaged = _get_salvaged(ctx.repo(), ms, ctx)
 for s in salvaged:
 files.mark_salvaged(s)
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 5] commit: refactor salvage calculation to a different function

2020-10-13 Thread Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <7895pul...@gmail.com>
# Date 1602314615 -19800
#  Sat Oct 10 12:53:35 2020 +0530
# Node ID d3df36bcf4a885038d5df6302f18008945ce48e7
# Parent  ca34efec098e04ef39341ef181c038f4a4522148
# EXP-Topic merge-newnode-final
commit: refactor salvage calculation to a different function

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

diff --git a/mercurial/commit.py b/mercurial/commit.py
--- a/mercurial/commit.py
+++ b/mercurial/commit.py
@@ -140,20 +140,29 @@ def _prepare_files(tr, ctx, error=False,
 files.update_copies_from_p1(ctx.p1copies())
 files.update_copies_from_p2(ctx.p2copies())
 
-copy_sd = ctx.repo().filecopiesmode == b'changeset-sidedata'
+ms = mergestate.mergestate.read(repo)
+salvaged = _get_salvaged(ctx.repo(), ms, ctx)
+for s in salvaged:
+files.mark_salvaged(s)
+
+return mn, files
+
+
+def _get_salvaged(repo, ms, ctx):
+""" returns a list of salvaged files
+
+returns empty list if config option which process salvaged files are
+not enabled """
+salvaged = []
+copy_sd = repo.filecopiesmode == b'changeset-sidedata'
 if copy_sd and len(ctx.parents()) > 1:
-# XXX this `mergestate.read` could be duplicated with a the merge state
-# reading in _process_files So we could refactor further to reuse it in
-# some cases.
-ms = mergestate.mergestate.read(repo)
 if ms.active():
 for fname in sorted(ms.extras().keys()):
 might_removed = 
ms.extras(fname).get(b'merge-removal-candidate')
 if might_removed == b'yes':
 if fname in ctx:
-files.mark_salvaged(fname)
-
-return mn, files
+salvaged.append(fname)
+return salvaged
 
 
 def _process_files(tr, ctx, error=False):
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 5] mergestate: make filename argument optional in _mergestate_base.extras()

2020-10-13 Thread Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <7895pul...@gmail.com>
# Date 1602313984 -19800
#  Sat Oct 10 12:43:04 2020 +0530
# Node ID ca34efec098e04ef39341ef181c038f4a4522148
# Parent  64a9423450efb39d7f1bc5b6b2cca1efafb1870e
# EXP-Topic merge-newnode-final
mergestate: make filename argument optional in _mergestate_base.extras()

Earlier `extras()` can only be used for getting extra for a file. However at
couple of places in code, we wanted to iterate over all the extras stored with
the mergestate and they were accessing the private `_stateextras`.

Now, if filename is not passed, we return all the extras.

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

diff --git a/mercurial/commit.py b/mercurial/commit.py
--- a/mercurial/commit.py
+++ b/mercurial/commit.py
@@ -147,7 +147,7 @@ def _prepare_files(tr, ctx, error=False,
 # some cases.
 ms = mergestate.mergestate.read(repo)
 if ms.active():
-for fname in sorted(ms._stateextras.keys()):
+for fname in sorted(ms.extras().keys()):
 might_removed = 
ms.extras(fname).get(b'merge-removal-candidate')
 if might_removed == b'yes':
 if fname in ctx:
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -2107,7 +2107,7 @@ def debugmergestate(ui, repo, *args, **o
 fm_files.end()
 
 fm_extras = fm.nested(b'extras')
-for f, d in sorted(pycompat.iteritems(ms._stateextras)):
+for f, d in sorted(pycompat.iteritems(ms.extras())):
 if f in ms:
 # If file is in mergestate, we have already processed it's extras
 continue
diff --git a/mercurial/mergestate.py b/mercurial/mergestate.py
--- a/mercurial/mergestate.py
+++ b/mercurial/mergestate.py
@@ -305,7 +305,12 @@ class _mergestate_base(object):
 ):
 yield f
 
-def extras(self, filename):
+def extras(self, filename=None):
+""" return extras stored with the mergestate
+
+if filename is passed, extras for that file is only returned """
+if filename is None:
+return self._stateextras
 return self._stateextras[filename]
 
 def _resolve(self, preresolve, dfile, wctx):
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH website] about: replace OpenJDK repository example by nginx repository

2020-10-13 Thread Pulkit Goyal
On Mon, Oct 12, 2020 at 9:06 PM Stephane Blondon
 wrote:
>
> # HG changeset patch
> # User "Stephane" 
> # Date 1602515246 -7200
> #  Mon Oct 12 17:07:26 2020 +0200
> # Node ID 25287ad72e44250962a2143c77da772cc56c6a68
> # Parent  175611e814012885f16543a7fc61ca68d8c5bb64
> about: replace OpenJDK repository example by nginx repository
>
> OpenJDK does not use Mercurial anymore and nginx uses it.

Queued this too, many thanks!
___
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-10-13 Thread Pulkit Goyal
On Mon, Oct 12, 2020 at 10:36 PM Augie Fackler  wrote:
>
> Pulkit, do you know who has website access right now?

I have the access, pushed these patches. Seems like I missed then
initially. Kindly use `--flag website` for website related patches.
>
> > On Oct 12, 2020, at 12:46, Manuel Jacob  wrote:
> >
> > None of the two patches ever got committed.
> >
> > On 06/08/2020 12.50, Pierre-Yves David wrote:
> >> 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  >>> href="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.
> >>>>>> href="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
> >>>
> >
> > ___
> > 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