mercurial@43939: 3 new changesets

2019-12-19 Thread Mercurial Commits
3 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/4ca89cc20d02
changeset:   43937:4ca89cc20d02
user:Rodrigo Damazio Bovendorp 
date:Wed Dec 18 23:41:36 2019 -0800
summary: status: extract active-merge state for reuse

https://www.mercurial-scm.org/repo/hg/rev/489fdf27769c
changeset:   43938:489fdf27769c
user:Rodrigo Damazio Bovendorp 
date:Wed Dec 18 23:43:21 2019 -0800
summary: status: make morestatus call out unresolved conflicts after update

https://www.mercurial-scm.org/repo/hg/rev/07ebb567e8bb
changeset:   43939:07ebb567e8bb
bookmark:@
tag: tip
user:Rodrigo Damazio Bovendorp 
date:Wed Dec 18 23:45:11 2019 -0800
summary: status: make unresolved files always be in the morestatus 
structured output

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


D7653: rust-index: add a function to convert PyObject index for hg-core

2019-12-19 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18887.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7653?vs=18699&id=18887

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

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

AFFECTED FILES
  rust/hg-cpython/src/ancestors.rs
  rust/hg-cpython/src/dagops.rs
  rust/hg-cpython/src/discovery.rs
  rust/hg-cpython/src/lib.rs
  rust/hg-cpython/src/revlog.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/revlog.rs b/rust/hg-cpython/src/revlog.rs
new file mode 100644
--- /dev/null
+++ b/rust/hg-cpython/src/revlog.rs
@@ -0,0 +1,17 @@
+// revlog.rs
+//
+// Copyright 2019 Georges Racinet 
+//
+// This software may be used and distributed according to the terms of the
+// GNU General Public License version 2 or any later version.
+
+use crate::cindex;
+use cpython::{PyObject, PyResult, Python};
+
+/// Return a Struct implementing the Graph trait
+pub(crate) fn pyindex_to_graph(
+py: Python,
+index: PyObject,
+) -> PyResult {
+cindex::Index::new(py, index)
+}
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
@@ -35,6 +35,7 @@
 pub mod exceptions;
 pub mod filepatterns;
 pub mod parsers;
+pub mod revlog;
 pub mod utils;
 
 py_module_initializer!(rustext, initrustext, PyInit_rustext, |py, m| {
diff --git a/rust/hg-cpython/src/discovery.rs b/rust/hg-cpython/src/discovery.rs
--- a/rust/hg-cpython/src/discovery.rs
+++ b/rust/hg-cpython/src/discovery.rs
@@ -25,6 +25,8 @@
 
 use std::cell::RefCell;
 
+use crate::revlog::pyindex_to_graph;
+
 py_class!(pub class PartialDiscovery |py| {
 data inner: RefCell>>;
 
@@ -42,7 +44,7 @@
 Self::create_instance(
 py,
 RefCell::new(Box::new(CorePartialDiscovery::new(
-Index::new(py, index)?,
+pyindex_to_graph(py, index)?,
 rev_pyiter_collect(py, &targetheads)?,
 respectsize,
 randomize,
diff --git a/rust/hg-cpython/src/dagops.rs b/rust/hg-cpython/src/dagops.rs
--- a/rust/hg-cpython/src/dagops.rs
+++ b/rust/hg-cpython/src/dagops.rs
@@ -9,14 +9,14 @@
 //! `hg-core` package.
 //!
 //! From Python, this will be seen as `mercurial.rustext.dagop`
-use crate::{
-cindex::Index, conversion::rev_pyiter_collect, exceptions::GraphError,
-};
+use crate::{conversion::rev_pyiter_collect, exceptions::GraphError};
 use cpython::{PyDict, PyModule, PyObject, PyResult, Python};
 use hg::dagops;
 use hg::Revision;
 use std::collections::HashSet;
 
+use crate::revlog::pyindex_to_graph;
+
 /// Using the the `index`, return heads out of any Python iterable of Revisions
 ///
 /// This is the Rust counterpart for `mercurial.dagop.headrevs`
@@ -26,7 +26,7 @@
 revs: PyObject,
 ) -> PyResult> {
 let mut as_set: HashSet = rev_pyiter_collect(py, &revs)?;
-dagops::retain_heads(&Index::new(py, index)?, &mut as_set)
+dagops::retain_heads(&pyindex_to_graph(py, index)?, &mut as_set)
 .map_err(|e| GraphError::pynew(py, e))?;
 Ok(as_set)
 }
diff --git a/rust/hg-cpython/src/ancestors.rs b/rust/hg-cpython/src/ancestors.rs
--- a/rust/hg-cpython/src/ancestors.rs
+++ b/rust/hg-cpython/src/ancestors.rs
@@ -34,6 +34,7 @@
 //! [`LazyAncestors`]: struct.LazyAncestors.html
 //! [`MissingAncestors`]: struct.MissingAncestors.html
 //! [`AncestorsIterator`]: struct.AncestorsIterator.html
+use crate::revlog::pyindex_to_graph;
 use crate::{
 cindex::Index, conversion::rev_pyiter_collect, exceptions::GraphError,
 };
@@ -73,7 +74,7 @@
 inclusive: bool) -> PyResult {
 let initvec: Vec = rev_pyiter_collect(py, &initrevs)?;
 let ait = CoreIterator::new(
-Index::new(py, index)?,
+pyindex_to_graph(py, index)?,
 initvec,
 stoprev,
 inclusive,
@@ -113,7 +114,8 @@
 let initvec: Vec = rev_pyiter_collect(py, &initrevs)?;
 
 let lazy =
-CoreLazy::new(Index::new(py, index)?, initvec, stoprev, inclusive)
+CoreLazy::new(pyindex_to_graph(py, index)?,
+  initvec, stoprev, inclusive)
 .map_err(|e| GraphError::pynew(py, e))?;
 
 Self::create_instance(py, RefCell::new(Box::new(lazy)))
@@ -126,7 +128,7 @@
 
 def __new__(_cls, index: PyObject, bases: PyObject) -> 
PyResult {
 let bases_vec: Vec = rev_pyiter_collect(py, &bases)?;
-let inner = CoreMissing::new(Index::new(py, index)?, bases_vec);
+let inner = CoreMissing::new(pyindex_to_graph(py, index)?, bases_vec);
 MissingAncestors::create_instance(py, RefCell::new(Box::new(inner)))
 }
 



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


D7658: rust-index: expose a method to retrieve the C index

2019-12-19 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18891.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7658?vs=18704&id=18891

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

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

AFFECTED FILES
  rust/hg-cpython/src/revlog.rs
  tests/test-rust-revlog.py

CHANGE DETAILS

diff --git a/tests/test-rust-revlog.py b/tests/test-rust-revlog.py
--- a/tests/test-rust-revlog.py
+++ b/tests/test-rust-revlog.py
@@ -25,6 +25,13 @@
 rustidx = revlog.MixedIndex(idx)
 self.assertEqual(rustidx.headrevs(), idx.headrevs())
 
+def test_get_cindex(self):
+# drop me once we no longer need the method for shortest node
+idx = self.parseindex()
+rustidx = revlog.MixedIndex(idx)
+cidx = rustidx.get_cindex()
+self.assertTrue(idx is cidx)
+
 def test_len(self):
 idx = self.parseindex()
 rustidx = revlog.MixedIndex(idx)
diff --git a/rust/hg-cpython/src/revlog.rs b/rust/hg-cpython/src/revlog.rs
--- a/rust/hg-cpython/src/revlog.rs
+++ b/rust/hg-cpython/src/revlog.rs
@@ -32,6 +32,17 @@
 cindex::Index::new(py, cindex)?))
 }
 
+/// Compatibility layer used for Python consumers needing access to the C 
index
+///
+/// Only use case so far is `scmutil.shortesthexnodeidprefix`,
+/// that may need to build a custom `nodetree`, based on a specified 
revset.
+/// With a Rust implementation of the nodemap, we will be able to get rid 
of
+/// this, by exposing our own standalone nodemap class,
+/// ready to accept `MixedIndex`.
+def get_cindex(&self) -> PyResult {
+Ok(self.cindex(py).borrow().inner().clone_ref(py))
+}
+
 
 // Reforwarded C index API
 



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


D7656: rust-index: make it possible to clone the struct referencing the C index

2019-12-19 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18889.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7656?vs=18702&id=18889

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

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

AFFECTED FILES
  rust/hg-cpython/src/cindex.rs
  rust/hg-cpython/src/revlog.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/revlog.rs b/rust/hg-cpython/src/revlog.rs
--- a/rust/hg-cpython/src/revlog.rs
+++ b/rust/hg-cpython/src/revlog.rs
@@ -7,8 +7,8 @@
 
 use crate::cindex;
 use cpython::{
-ObjectProtocol, PyDict, PyModule, PyObject, PyResult, PyTuple, Python,
-PythonObject, ToPyObject,
+ObjectProtocol, PyClone, PyDict, PyModule, PyObject, PyResult, PyTuple,
+Python, PythonObject, ToPyObject,
 };
 use hg::Revision;
 use std::cell::RefCell;
@@ -198,6 +198,10 @@
 .inner()
 .call_method(py, name, args, kwargs)
 }
+
+pub fn clone_cindex(&self, py: Python) -> cindex::Index {
+self.cindex(py).borrow().clone_ref(py)
+}
 }
 
 /// Create the module, with __package__ given from parent
diff --git a/rust/hg-cpython/src/cindex.rs b/rust/hg-cpython/src/cindex.rs
--- a/rust/hg-cpython/src/cindex.rs
+++ b/rust/hg-cpython/src/cindex.rs
@@ -85,6 +85,15 @@
 }
 }
 
+impl PyClone for Index {
+fn clone_ref(&self, py: Python) -> Self {
+Index {
+index: self.index.clone_ref(py),
+parents: self.parents.clone(),
+}
+}
+}
+
 impl Graph for Index {
 /// wrap a call to the C extern parents function
 fn parents(&self, rev: Revision) -> Result<[Revision; 2], GraphError> {



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


D7655: rust-index: add a struct wrapping the C index

2019-12-19 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 1.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7655?vs=18701&id=1

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

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

AFFECTED FILES
  rust/hg-cpython/src/lib.rs
  rust/hg-cpython/src/revlog.rs
  tests/test-rust-revlog.py

CHANGE DETAILS

diff --git a/tests/test-rust-revlog.py b/tests/test-rust-revlog.py
new file mode 100644
--- /dev/null
+++ b/tests/test-rust-revlog.py
@@ -0,0 +1,34 @@
+from __future__ import absolute_import
+import unittest
+
+try:
+from mercurial import rustext
+
+rustext.__name__  # trigger immediate actual import
+except ImportError:
+rustext = None
+else:
+from mercurial.rustext import revlog
+
+from mercurial.testing import revlog as revlogtesting
+
+
+@unittest.skipIf(
+rustext is None, "rustext module ancestor relies on is not available",
+)
+class RustRevlogIndexTest(revlogtesting.RevlogBasedTestBase):
+def test_heads(self):
+idx = self.parseindex()
+rustidx = revlog.MixedIndex(idx)
+self.assertEqual(rustidx.headrevs(), idx.headrevs())
+
+def test_len(self):
+idx = self.parseindex()
+rustidx = revlog.MixedIndex(idx)
+self.assertEqual(len(rustidx), len(idx))
+
+
+if __name__ == '__main__':
+import silenttestrunner
+
+silenttestrunner.main(__name__)
diff --git a/rust/hg-cpython/src/revlog.rs b/rust/hg-cpython/src/revlog.rs
--- a/rust/hg-cpython/src/revlog.rs
+++ b/rust/hg-cpython/src/revlog.rs
@@ -6,7 +6,12 @@
 // GNU General Public License version 2 or any later version.
 
 use crate::cindex;
-use cpython::{PyObject, PyResult, Python};
+use cpython::{
+ObjectProtocol, PyDict, PyModule, PyObject, PyResult, PyTuple, Python,
+PythonObject, ToPyObject,
+};
+use hg::Revision;
+use std::cell::RefCell;
 
 /// Return a Struct implementing the Graph trait
 pub(crate) fn pyindex_to_graph(
@@ -15,3 +20,198 @@
 ) -> PyResult {
 cindex::Index::new(py, index)
 }
+
+py_class!(pub class MixedIndex |py| {
+data cindex: RefCell;
+
+def __new__(_cls, cindex: PyObject) -> PyResult {
+Self::create_instance(py, RefCell::new(
+cindex::Index::new(py, cindex)?))
+}
+
+
+// Reforwarded C index API
+
+// index_methods (tp_methods). Same ordering as in revlog.c
+
+/// return the gca set of the given revs
+def ancestors(&self, *args, **kw) -> PyResult {
+self.call_cindex(py, "ancestors", args, kw)
+}
+
+/// return the heads of the common ancestors of the given revs
+def commonancestorsheads(&self, *args, **kw) -> PyResult {
+self.call_cindex(py, "commonancestorsheads", args, kw)
+}
+
+/// clear the index caches
+def clearcaches(&self, *args, **kw) -> PyResult {
+self.call_cindex(py, "clearcaches", args, kw)
+}
+
+/// get an index entry
+def get(&self, *args, **kw) -> PyResult {
+self.call_cindex(py, "get", args, kw)
+}
+
+/// return `rev` associated with a node or None
+def get_rev(&self, *args, **kw) -> PyResult {
+self.call_cindex(py, "get_rev", args, kw)
+}
+
+/// return True if the node exist in the index
+def has_node(&self, *args, **kw) -> PyResult {
+self.call_cindex(py, "has_node", args, kw)
+}
+
+/// return `rev` associated with a node or raise RevlogError
+def rev(&self, *args, **kw) -> PyResult {
+self.call_cindex(py, "rev", args, kw)
+}
+
+/// compute phases
+def computephasesmapsets(&self, *args, **kw) -> PyResult {
+self.call_cindex(py, "computephasesmapsets", args, kw)
+}
+
+/// reachableroots
+def reachableroots2(&self, *args, **kw) -> PyResult {
+self.call_cindex(py, "reachableroots2", args, kw)
+}
+
+/// get head revisions
+def headrevs(&self, *args, **kw) -> PyResult {
+self.call_cindex(py, "headrevs", args, kw)
+}
+
+/// get filtered head revisions
+def headrevsfiltered(&self, *args, **kw) -> PyResult {
+self.call_cindex(py, "headrevsfiltered", args, kw)
+}
+
+/// True if the object is a snapshot
+def issnapshot(&self, *args, **kw) -> PyResult {
+self.call_cindex(py, "issnapshot", args, kw)
+}
+
+/// Gather snapshot data in a cache dict
+def findsnapshots(&self, *args, **kw) -> PyResult {
+self.call_cindex(py, "findsnapshots", args, kw)
+}
+
+/// determine revisions with deltas to reconstruct fulltext
+def deltachain(&self, *args, **kw) -> PyResult {
+self.call_cindex(py, "deltachain", args, kw)
+}
+
+/// slice planned chunk read to reach a density threshold
+def slicechunktodensity(&self, *args, **kw) -> PyResult {
+self.call_cindex(py, "slicechunktodensity", args, kw)
+}
+
+/// append an index entry
+def append(&self, *args, **kw) -> PyResult {
+self.call_cindex(py, "append", arg

D7657: rust-index: handle `MixedIndex` in `pyindex_to_graph`

2019-12-19 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18890.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7657?vs=18703&id=18890

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

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

AFFECTED FILES
  rust/hg-cpython/src/revlog.rs
  tests/test-rust-revlog.py

CHANGE DETAILS

diff --git a/tests/test-rust-revlog.py b/tests/test-rust-revlog.py
--- a/tests/test-rust-revlog.py
+++ b/tests/test-rust-revlog.py
@@ -10,6 +10,9 @@
 else:
 from mercurial.rustext import revlog
 
+# this would fail already without appropriate ancestor.__package__
+from mercurial.rustext.ancestor import LazyAncestors
+
 from mercurial.testing import revlog as revlogtesting
 
 
@@ -27,6 +30,22 @@
 rustidx = revlog.MixedIndex(idx)
 self.assertEqual(len(rustidx), len(idx))
 
+def test_ancestors(self):
+idx = self.parseindex()
+rustidx = revlog.MixedIndex(idx)
+lazy = LazyAncestors(rustidx, [3], 0, True)
+# we have two more references to the index:
+# - in its inner iterator for __contains__ and __bool__
+# - in the LazyAncestors instance itself (to spawn new iterators)
+self.assertTrue(2 in lazy)
+self.assertTrue(bool(lazy))
+self.assertEqual(list(lazy), [3, 2, 1, 0])
+# a second time to validate that we spawn new iterators
+self.assertEqual(list(lazy), [3, 2, 1, 0])
+
+# let's check bool for an empty one
+self.assertFalse(LazyAncestors(idx, [0], 0, False))
+
 
 if __name__ == '__main__':
 import silenttestrunner
diff --git a/rust/hg-cpython/src/revlog.rs b/rust/hg-cpython/src/revlog.rs
--- a/rust/hg-cpython/src/revlog.rs
+++ b/rust/hg-cpython/src/revlog.rs
@@ -18,7 +18,10 @@
 py: Python,
 index: PyObject,
 ) -> PyResult {
-cindex::Index::new(py, index)
+match index.extract::(py) {
+Ok(midx) => Ok(midx.clone_cindex(py)),
+Err(_) => cindex::Index::new(py, index),
+}
 }
 
 py_class!(pub class MixedIndex |py| {



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


D7651: nodetree: simplify a conditionnal in shortesthexnodeidprefix

2019-12-19 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18886.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7651?vs=18806&id=18886

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

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

AFFECTED FILES
  mercurial/scmutil.py

CHANGE DETAILS

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -545,12 +545,10 @@
 if cache is not None:
 nodetree = cache.get(b'disambiguationnodetree')
 if not nodetree:
-try:
+if util.safehasattr(parsers, 'nodetree'):
+# The CExt is the only implementation to provide a nodetree
+# class so far.
 nodetree = parsers.nodetree(cl.index, len(revs))
-except AttributeError:
-# no native nodetree
-pass
-else:
 for r in revs:
 nodetree.insert(r)
 if cache is not None:



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


D7695: patch: fix header.__repr__() to not have `b''` prefixes in file names

2019-12-19 Thread mharbison72 (Matt Harbison)
Closed by commit rHG0671f0a19d93: patch: fix header.__repr__() to not have 
`b''` prefixes in file names (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7695?vs=18840&id=18885

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

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

AFFECTED FILES
  mercurial/patch.py

CHANGE DETAILS

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -963,7 +963,9 @@
 return self.files()[-1]
 
 def __repr__(self):
-return '' % (' '.join(map(repr, self.files(
+return '' % (
+' '.join(pycompat.rapply(pycompat.fsdecode, self.files()))
+)
 
 def isnewfile(self):
 return any(self.newfile_re.match(h) for h in self.header)



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


D7699: cmdutil: allow native string as input to check_at_most_one_arg()

2019-12-19 Thread martinvonz (Martin von Zweigbergk)
Closed by commit rHG6c8108274dc5: cmdutil: allow native string as input to 
check_at_most_one_arg() (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7699?vs=18866&id=18884

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

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

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -267,7 +267,7 @@
 """
 
 def to_display(name):
-return name.replace(b'_', b'-')
+return pycompat.sysbytes(name).replace(b'_', b'-')
 
 previous = None
 for x in args:



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


D7698: cmdutil: return underscore-separate name from check_at_most_one_arg()

2019-12-19 Thread martinvonz (Martin von Zweigbergk)
Closed by commit rHGdfac25883dbf: cmdutil: return underscore-separate name from 
check_at_most_one_arg() (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7698?vs=18865&id=18883

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

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

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -265,13 +265,17 @@
 
 Returns the unique argument or None if none of them were specified.
 """
+
+def to_display(name):
+return name.replace(b'_', b'-')
+
 previous = None
 for x in args:
 if opts.get(x):
-x = x.replace(b'_', b'-')
 if previous:
 raise error.Abort(
-_(b'cannot specify both --%s and --%s') % (previous, x)
+_(b'cannot specify both --%s and --%s')
+% (to_display(previous), to_display(x))
 )
 previous = x
 return previous



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


D7668: status: make unresolved files always be in the morestatus structured output

2019-12-19 Thread rdamazio (Rodrigo Damazio Bovendorp)
Closed by commit rHG07ebb567e8bb: status: make unresolved files always be in 
the morestatus structured output (authored by rdamazio).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7668?vs=18877&id=18881

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

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

AFFECTED FILES
  mercurial/cmdutil.py
  tests/test-update-branches.t

CHANGE DETAILS

diff --git a/tests/test-update-branches.t b/tests/test-update-branches.t
--- a/tests/test-update-branches.t
+++ b/tests/test-update-branches.t
@@ -591,6 +591,11 @@
 "itemtype": "file",
 "path": "foo",
 "status": "M"
+   },
+   {
+"itemtype": "file",
+"path": "a",
+"unresolved": true
}
   ]
 
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -811,9 +811,11 @@
 unfinishedmsg = attr.ib()
 activemerge = attr.ib()
 unresolvedpaths = attr.ib()
+_formattedpaths = attr.ib(init=False, default=set())
 _label = b'status.morestatus'
 
 def formatfile(self, path, fm):
+self._formattedpaths.add(path)
 if self.activemerge and path in self.unresolvedpaths:
 fm.data(unresolved=True)
 
@@ -832,6 +834,7 @@
 if self.unfinishedmsg:
 fm.data(unfinishedmsg=self.unfinishedmsg)
 
+# May also start new data items.
 self._formatconflicts(fm)
 
 if self.unfinishedmsg:
@@ -861,6 +864,19 @@
 )
 % mergeliststr
 )
+
+# If any paths with unresolved conflicts were not previously
+# formatted, output them now.
+for f in self.unresolvedpaths:
+if f in self._formattedpaths:
+# Already output.
+continue
+fm.startitem()
+# We can't claim to know the status of the file - it may just
+# have been in one of the states that were not requested for
+# display, so it could be anything.
+fm.data(itemtype=b'file', path=f, unresolved=True)
+
 else:
 msg = _(b'No unresolved merge conflicts.')
 



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


D7704: status: make morestatus call out unresolved conflicts after update

2019-12-19 Thread rdamazio (Rodrigo Damazio Bovendorp)
Closed by commit rHG489fdf27769c: status: make morestatus call out unresolved 
conflicts after update (authored by rdamazio).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7704?vs=18876&id=18880

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

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

AFFECTED FILES
  mercurial/cmdutil.py
  tests/test-update-branches.t

CHANGE DETAILS

diff --git a/tests/test-update-branches.t b/tests/test-update-branches.t
--- a/tests/test-update-branches.t
+++ b/tests/test-update-branches.t
@@ -252,6 +252,12 @@
   $ hg st
   M a
   ? a.orig
+  # Unresolved merge conflicts:
+  # 
+  # a
+  # 
+  # To mark files as resolved:  hg resolve --mark FILE
+  
   $ cat a
   <<< working copy: 6efa171f091b - test: 3
   three
@@ -315,6 +321,12 @@
   $ rm a.orig
   $ hg status
   M a
+  # Unresolved merge conflicts:
+  # 
+  # a
+  # 
+  # To mark files as resolved:  hg resolve --mark FILE
+  
   $ hg resolve -l
   U a
 
@@ -553,6 +565,12 @@
   $ hg status
   M a
   M foo
+  # Unresolved merge conflicts:
+  # 
+  # a
+  # 
+  # To mark files as resolved:  hg resolve --mark FILE
+  
 
   $ hg revert -r . a
 
@@ -561,6 +579,12 @@
   U a
   $ hg status
   M foo
+  # Unresolved merge conflicts:
+  # 
+  # a
+  # 
+  # To mark files as resolved:  hg resolve --mark FILE
+  
   $ hg status -Tjson
   [
{
@@ -577,6 +601,8 @@
   R a
   $ hg status
   M foo
+  # No unresolved merge conflicts.
+  
   $ hg status -Tjson
   [
{
@@ -589,6 +615,8 @@
 Test that 4 is detected as the no-argument destination from 3 and also moves
 the bookmark with it
   $ hg up --quiet 0  # we should be able to update to 3 directly
+  $ hg status
+  M foo
   $ hg up --quiet --hidden 3 # but not implemented yet.
   updated to hidden changeset 6efa171f091b
   (hidden revision '6efa171f091b' was rewritten as: d047485b3896)
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -818,20 +818,22 @@
 fm.data(unresolved=True)
 
 def formatfooter(self, fm):
-fm.startitem()
-fm.data(
-itemtype=b'morestatus',
-unfinished=self.unfinishedop,
-unfinishedmsg=self.unfinishedmsg,
-)
-
-statemsg = (
-_(b'The repository is in an unfinished *%s* state.')
-% self.unfinishedop
-)
-fm.plain(b'%s\n' % _commentlines(statemsg), label=self._label)
+if self.unfinishedop or self.unfinishedmsg:
+fm.startitem()
+fm.data(itemtype=b'morestatus')
+
+if self.unfinishedop:
+fm.data(unfinished=self.unfinishedop)
+statemsg = (
+_(b'The repository is in an unfinished *%s* state.')
+% self.unfinishedop
+)
+fm.plain(b'%s\n' % _commentlines(statemsg), label=self._label)
+if self.unfinishedmsg:
+fm.data(unfinishedmsg=self.unfinishedmsg)
 
 self._formatconflicts(fm)
+
 if self.unfinishedmsg:
 fm.plain(
 b'%s\n' % _commentlines(self.unfinishedmsg), label=self._label
@@ -870,12 +872,12 @@
 statetuple = statemod.getrepostate(repo)
 mergestate = mergemod.mergestate.read(repo)
 activemerge = mergestate.active()
-if not statetuple:
+if not statetuple and not activemerge:
 return None
 
-unfinishedop, unfinishedmsg = statetuple
-mergestate = mergemod.mergestate.read(repo)
-unresolved = None
+unfinishedop = unfinishedmsg = unresolved = None
+if statetuple:
+unfinishedop, unfinishedmsg = statetuple
 if activemerge:
 unresolved = sorted(mergestate.unresolved())
 return morestatus(



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


D7667: status: extract active-merge state for reuse

2019-12-19 Thread rdamazio (Rodrigo Damazio Bovendorp)
Closed by commit rHG4ca89cc20d02: status: extract active-merge state for reuse 
(authored by rdamazio).
This revision was automatically updated to reflect the committed changes.

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D7667?vs=18875&id=18879#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7667?vs=18875&id=18879

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

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

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -809,12 +809,12 @@
 reporoot = attr.ib()
 unfinishedop = attr.ib()
 unfinishedmsg = attr.ib()
-inmergestate = attr.ib()
+activemerge = attr.ib()
 unresolvedpaths = attr.ib()
 _label = b'status.morestatus'
 
 def formatfile(self, path, fm):
-if self.inmergestate and path in self.unresolvedpaths:
+if self.activemerge and path in self.unresolvedpaths:
 fm.data(unresolved=True)
 
 def formatfooter(self, fm):
@@ -838,7 +838,7 @@
 )
 
 def _formatconflicts(self, fm):
-if not self.inmergestate:
+if not self.activemerge:
 return
 
 if self.unresolvedpaths:
@@ -868,20 +868,18 @@
 def readmorestatus(repo):
 """Returns a morestatus object if the repo has unfinished state."""
 statetuple = statemod.getrepostate(repo)
+mergestate = mergemod.mergestate.read(repo)
+activemerge = mergestate.active()
 if not statetuple:
 return None
 
 unfinishedop, unfinishedmsg = statetuple
 mergestate = mergemod.mergestate.read(repo)
 unresolved = None
-if mergestate.active():
+if activemerge:
 unresolved = sorted(mergestate.unresolved())
 return morestatus(
-repo.root,
-unfinishedop,
-unfinishedmsg,
-unresolved is not None,
-unresolved,
+repo.root, unfinishedop, unfinishedmsg, activemerge, unresolved
 )
 
 



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


D7697: rebase: restore i18n of a hint message

2019-12-19 Thread martinvonz (Martin von Zweigbergk)
Closed by commit rHGd77230743968: rebase: restore i18n of a hint message 
(authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7697?vs=18864&id=18882

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

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

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
@@ -399,7 +399,7 @@
 rewriteutil.precheck(self.repo, rebaseset, action=b'rebase')
 except error.Abort as e:
 if e.hint is None:
-e.hint = b'use --keep to keep original changesets'
+e.hint = _(b'use --keep to keep original changesets')
 raise e
 
 result = buildstate(self.repo, destmap, self.collapsef)



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


D7667: status: extract active-merge state for reuse

2019-12-19 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  Amended the following in flight to make black happy:
  
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -879,11 +879,8 @@ def readmorestatus(repo):
 if activemerge:
 unresolved = sorted(mergestate.unresolved())
 return morestatus(
-repo.root,
-unfinishedop,
-unfinishedmsg,
-activemerge,
-unresolved)
+repo.root, unfinishedop, unfinishedmsg, activemerge, unresolved
+)
 
 
 def findpossible(cmd, table, strict=False):

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

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


D7699: cmdutil: allow native string as input to check_at_most_one_arg()

2019-12-19 Thread pulkit (Pulkit Goyal)
This revision is now accepted and ready to land.
pulkit added a comment.
pulkit accepted this revision.


  I hope one day we have a clear understanding of what is bytes and what is not 
in core.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

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


D7705: phases: make the working directory consistently a draft

2019-12-19 Thread marmoute (Pierre-Yves David)
marmoute added a comment.


  The working copy is not necessarly draft phase. For example, it will be 
secret is the working copy parent is secret. One can also control it using the 
`phases.new-commit` config.
  
  The `mercurial.phases.newcommitphase(ui)` function can help you there.

REPOSITORY
  rHG Mercurial

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

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

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


Re: [PATCH STABLE v2] py3: force bytestr conversion of "reason" in scmutil.callcatch()

2019-12-19 Thread Yuya Nishihara
On Wed, 18 Dec 2019 20:19:43 +0100, Denis Laxalde wrote:
> # HG changeset patch
> # User Denis Laxalde 
> # Date 1576696641 -3600
> #  Wed Dec 18 20:17:21 2019 +0100
> # Branch stable
> # Node ID 33249635134f8c3fdcd79b1a0da15880a2f57650
> # Parent  743c69b393326ab82383638c1fed669794ac0ec1
> py3: force bytestr conversion of "reason" in scmutil.callcatch()

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


Re: Heptapod as a Bitbucket replacement - inviting Mercurial FOSS projects

2019-12-19 Thread Marcin Kasperski
> A key part is that Heptapod is now inviting all generic FOSS projects
> related to Mercurial to come over from Bitbucket to our own Heptapod
> server.

I filled my request¹ but I doesn't seem to have rights to attach label
to the issue. Or I don't know how to do it.

Thank you for your offer. BTW: maybe this is good time to think about
indexing those projects automatically somehow?


¹ https://dev.heptapod.net/heptapod/dev.heptapod.net/issues/3


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


D7705: phases: make the working directory consistently a draft

2019-12-19 Thread rdamazio (Rodrigo Damazio Bovendorp)
rdamazio created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Before this change, `hg log -r 'wdir() and public()'` would return it.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/phases.py
  tests/test-phases.t

CHANGE DETAILS

diff --git a/tests/test-phases.t b/tests/test-phases.t
--- a/tests/test-phases.t
+++ b/tests/test-phases.t
@@ -48,6 +48,15 @@
   1 1 B
   0 1 A
 
+Working directory is a draft.
+
+  $ hg log -r 'wdir()' -T '{phase}\n'
+  draft
+  $ hg log -r 'wdir() and public()' -T '{phase}\n'
+  $ hg log -r 'wdir() and draft()' -T '{phase}\n'
+  draft
+  $ hg log -r 'wdir() and secret()' -T '{phase}\n'
+
 Draft commit are properly created over public one:
 
   $ hg phase --public .
diff --git a/mercurial/phases.py b/mercurial/phases.py
--- a/mercurial/phases.py
+++ b/mercurial/phases.py
@@ -112,6 +112,7 @@
 nullid,
 nullrev,
 short,
+wdirrev,
 )
 from .pycompat import (
 getattr,
@@ -252,25 +253,43 @@
 revs = set.union(*[self._phasesets[p] for p in phases])
 if repo.changelog.filteredrevs:
 revs = revs - repo.changelog.filteredrevs
+
 if subset is None:
 return smartset.baseset(revs)
 else:
+if wdirrev in subset and draft in phases:
+# The working dir would never be in the cache, but it 
should
+# be considered a draft - if it's in the subset being
+# filtered for drafts, add it to the output.
+revs.add(wdirrev)
+
 return subset & smartset.baseset(revs)
 else:
+# phases keeps all the *other* phases.
 phases = set(allphases).difference(phases)
 if not phases:
 return smartset.fullreposet(repo)
+
+# revs has the revisions in all *other* phases.
 if len(phases) == 1:
 [p] = phases
 revs = self._phasesets[p]
 else:
 revs = set.union(*[self._phasesets[p] for p in phases])
+
 if subset is None:
 subset = smartset.fullreposet(repo)
 if not revs:
 return subset
+if wdirrev in subset and draft in phases:
+# The working dir is in the subset being filtered, and draft is
+# in the phases *not* being returned, so add it to the set of
+# revisions to filter out.
+revs.add(wdirrev)
+
 return subset.filter(lambda r: r not in revs)
 
+
 def copy(self):
 # Shallow copy meant to ensure isolation in
 # advance/retractboundary(), nothing more.



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


D7668: status: make unresolved files always be in the morestatus structured output

2019-12-19 Thread rdamazio (Rodrigo Damazio Bovendorp)
rdamazio marked an inline comment as done.
rdamazio updated this revision to Diff 18877.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7668?vs=18846&id=18877

BRANCH
  default

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

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

AFFECTED FILES
  mercurial/cmdutil.py
  tests/test-update-branches.t

CHANGE DETAILS

diff --git a/tests/test-update-branches.t b/tests/test-update-branches.t
--- a/tests/test-update-branches.t
+++ b/tests/test-update-branches.t
@@ -591,6 +591,11 @@
 "itemtype": "file",
 "path": "foo",
 "status": "M"
+   },
+   {
+"itemtype": "file",
+"path": "a",
+"unresolved": true
}
   ]
 
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -810,9 +810,11 @@
 unfinishedmsg = attr.ib()
 activemerge = attr.ib()
 unresolvedpaths = attr.ib()
+_formattedpaths = attr.ib(init=False, default=set())
 _label = b'status.morestatus'
 
 def formatfile(self, path, fm):
+self._formattedpaths.add(path)
 if self.activemerge and path in self.unresolvedpaths:
 fm.data(unresolved=True)
 
@@ -831,6 +833,7 @@
 if self.unfinishedmsg:
 fm.data(unfinishedmsg=self.unfinishedmsg)
 
+# May also start new data items.
 self._formatconflicts(fm)
 
 if self.unfinishedmsg:
@@ -860,6 +863,19 @@
 )
 % mergeliststr
 )
+
+# If any paths with unresolved conflicts were not previously
+# formatted, output them now.
+for f in self.unresolvedpaths:
+if f in self._formattedpaths:
+# Already output.
+continue
+fm.startitem()
+# We can't claim to know the status of the file - it may just
+# have been in one of the states that were not requested for
+# display, so it could be anything.
+fm.data(itemtype=b'file', path=f, unresolved=True)
+
 else:
 msg = _(b'No unresolved merge conflicts.')
 



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


D7704: status: make morestatus call out unresolved conflicts after update

2019-12-19 Thread rdamazio (Rodrigo Damazio Bovendorp)
rdamazio created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/cmdutil.py
  tests/test-update-branches.t

CHANGE DETAILS

diff --git a/tests/test-update-branches.t b/tests/test-update-branches.t
--- a/tests/test-update-branches.t
+++ b/tests/test-update-branches.t
@@ -252,6 +252,12 @@
   $ hg st
   M a
   ? a.orig
+  # Unresolved merge conflicts:
+  # 
+  # a
+  # 
+  # To mark files as resolved:  hg resolve --mark FILE
+  
   $ cat a
   <<< working copy: 6efa171f091b - test: 3
   three
@@ -315,6 +321,12 @@
   $ rm a.orig
   $ hg status
   M a
+  # Unresolved merge conflicts:
+  # 
+  # a
+  # 
+  # To mark files as resolved:  hg resolve --mark FILE
+  
   $ hg resolve -l
   U a
 
@@ -553,6 +565,12 @@
   $ hg status
   M a
   M foo
+  # Unresolved merge conflicts:
+  # 
+  # a
+  # 
+  # To mark files as resolved:  hg resolve --mark FILE
+  
 
   $ hg revert -r . a
 
@@ -561,6 +579,12 @@
   U a
   $ hg status
   M foo
+  # Unresolved merge conflicts:
+  # 
+  # a
+  # 
+  # To mark files as resolved:  hg resolve --mark FILE
+  
   $ hg status -Tjson
   [
{
@@ -577,6 +601,8 @@
   R a
   $ hg status
   M foo
+  # No unresolved merge conflicts.
+  
   $ hg status -Tjson
   [
{
@@ -589,6 +615,8 @@
 Test that 4 is detected as the no-argument destination from 3 and also moves
 the bookmark with it
   $ hg up --quiet 0  # we should be able to update to 3 directly
+  $ hg status
+  M foo
   $ hg up --quiet --hidden 3 # but not implemented yet.
   updated to hidden changeset 6efa171f091b
   (hidden revision '6efa171f091b' was rewritten as: d047485b3896)
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -817,20 +817,22 @@
 fm.data(unresolved=True)
 
 def formatfooter(self, fm):
-fm.startitem()
-fm.data(
-itemtype=b'morestatus',
-unfinished=self.unfinishedop,
-unfinishedmsg=self.unfinishedmsg,
-)
-
-statemsg = (
-_(b'The repository is in an unfinished *%s* state.')
-% self.unfinishedop
-)
-fm.plain(b'%s\n' % _commentlines(statemsg), label=self._label)
+if self.unfinishedop or self.unfinishedmsg:
+fm.startitem()
+fm.data(itemtype=b'morestatus')
+
+if self.unfinishedop:
+fm.data(unfinished=self.unfinishedop)
+statemsg = (
+_(b'The repository is in an unfinished *%s* state.')
+% self.unfinishedop
+)
+fm.plain(b'%s\n' % _commentlines(statemsg), label=self._label)
+if self.unfinishedmsg:
+fm.data(unfinishedmsg=self.unfinishedmsg)
 
 self._formatconflicts(fm)
+
 if self.unfinishedmsg:
 fm.plain(
 b'%s\n' % _commentlines(self.unfinishedmsg), label=self._label
@@ -869,12 +871,12 @@
 statetuple = statemod.getrepostate(repo)
 mergestate = mergemod.mergestate.read(repo)
 activemerge = mergestate.active()
-if not statetuple:
+if not statetuple and not activemerge:
 return None
 
-unfinishedop, unfinishedmsg = statetuple
-mergestate = mergemod.mergestate.read(repo)
-unresolved = None
+unfinishedop = unfinishedmsg = unresolved = None
+if statetuple:
+unfinishedop, unfinishedmsg = statetuple
 if activemerge:
 unresolved = sorted(mergestate.unresolved())
 return morestatus(



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


D7667: status: extract active-merge state for reuse

2019-12-19 Thread rdamazio (Rodrigo Damazio Bovendorp)
rdamazio retitled this revision from "status: make morestatus call out 
unresolved conflicts after update" to "status: extract active-merge state for 
reuse".
rdamazio updated this revision to Diff 18875.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7667?vs=18845&id=18875

BRANCH
  default

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

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

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -808,12 +808,12 @@
 reporoot = attr.ib()
 unfinishedop = attr.ib()
 unfinishedmsg = attr.ib()
-inmergestate = attr.ib()
+activemerge = attr.ib()
 unresolvedpaths = attr.ib()
 _label = b'status.morestatus'
 
 def formatfile(self, path, fm):
-if self.inmergestate and path in self.unresolvedpaths:
+if self.activemerge and path in self.unresolvedpaths:
 fm.data(unresolved=True)
 
 def formatfooter(self, fm):
@@ -837,7 +837,7 @@
 )
 
 def _formatconflicts(self, fm):
-if not self.inmergestate:
+if not self.activemerge:
 return
 
 if self.unresolvedpaths:
@@ -867,21 +867,22 @@
 def readmorestatus(repo):
 """Returns a morestatus object if the repo has unfinished state."""
 statetuple = statemod.getrepostate(repo)
+mergestate = mergemod.mergestate.read(repo)
+activemerge = mergestate.active()
 if not statetuple:
 return None
 
 unfinishedop, unfinishedmsg = statetuple
 mergestate = mergemod.mergestate.read(repo)
 unresolved = None
-if mergestate.active():
+if activemerge:
 unresolved = sorted(mergestate.unresolved())
 return morestatus(
 repo.root,
 unfinishedop,
 unfinishedmsg,
-unresolved is not None,
-unresolved,
-)
+activemerge,
+unresolved)
 
 
 def findpossible(cmd, table, strict=False):



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