D11706: merge-halt: fix issue with merge.on-failure=halt breaking unshelve

2021-10-19 Thread spectral (Kyle Lippincott)
spectral created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/merge.py
  tests/test-merge-halt.t

CHANGE DETAILS

diff --git a/tests/test-merge-halt.t b/tests/test-merge-halt.t
--- a/tests/test-merge-halt.t
+++ b/tests/test-merge-halt.t
@@ -44,7 +44,7 @@
   merging a
   merging b
   merging a failed!
-  merge halted after failed merge (see hg resolve)
+  unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
   [240]
 
   $ hg resolve --list
@@ -72,7 +72,7 @@
   continue merge operation (yn)? y
   merging b failed!
   continue merge operation (yn)? n
-  merge halted after failed merge (see hg resolve)
+  unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
   [240]
 
   $ hg resolve --list
@@ -101,7 +101,7 @@
   was merge successful (yn)? n
   merging b failed!
   continue merge operation (yn)? n
-  merge halted after failed merge (see hg resolve)
+  unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
   [240]
 
   $ hg resolve --list
@@ -124,7 +124,7 @@
   merging a
   merging b
   merging a failed!
-  merge halted after failed merge (see hg resolve)
+  unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
   [240]
 
   $ hg resolve --list
@@ -145,7 +145,7 @@
   was merge of 'a' successful (yn)? y
   was merge of 'b' successful (yn)? n
   merging b failed!
-  merge halted after failed merge (see hg resolve)
+  unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
   [240]
 
   $ hg resolve --list
@@ -167,6 +167,9 @@
   $ cat <> $HGRCPATH
   > [extensions]
   > shelve =
+  > [merge-tools]
+  > false.check=conflicts
+  > false.premerge=false
   > EOS
   $ echo foo > shelve_file1
   $ echo foo > shelve_file2
@@ -186,15 +189,14 @@
   merging shelve_file1
   merging shelve_file2
   merging shelve_file1 failed!
-  merge halted after failed merge (see hg resolve)
+  unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
   [240]
-FIXME: This should claim it's in an 'unshelve' state
   $ hg status --config commands.status.verbose=True
   M shelve_file1
   M shelve_file2
   ? shelve_file1.orig
   ? shelve_file2.orig
-  # The repository is in an unfinished *update* state.
+  # The repository is in an unfinished *unshelve* state.
   
   # Unresolved merge conflicts:
   # 
@@ -203,16 +205,16 @@
   # 
   # To mark files as resolved:  hg resolve --mark FILE
   
-  # To continue:hg update .
+  # To continue:hg unshelve --continue
+  # To abort:   hg unshelve --abort
   
-FIXME: This should not be referencing a stripped commit.
   $ hg resolve --tool false --all --re-merge
-  abort: unknown revision '4a1d727ea5bb6aed9adfacb2a8f776bae44301d6'
-  [255]
-Ensure the shelve is still around, since we haven't finished the operation yet.
+  merging shelve_file1
+  merging shelve_file2
+  merging shelve_file1 failed!
+  merge halted after failed merge (see hg resolve)
+  [240]
   $ hg shelve --list
   default (* ago)changes to: foo (glob)
-FIXME: `hg unshelve --abort` should work.
   $ hg unshelve --abort
-  abort: no unshelve in progress
-  [20]
+  unshelve of 'default' aborted
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1713,6 +1713,10 @@
 progress.increment(item=f, total=numupdates)
 ms.resolve(f, wctx)
 
+except error.InterventionRequired:
+# If the user has merge.on-failure=halt, catch the error and close the
+# merge state "properly".
+pass
 finally:
 ms.commit()
 



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


D11705: merge-halt: demonstrate unshelve issue with merge.on-failure=halt

2021-10-19 Thread spectral (Kyle Lippincott)
spectral created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-merge-halt.t

CHANGE DETAILS

diff --git a/tests/test-merge-halt.t b/tests/test-merge-halt.t
--- a/tests/test-merge-halt.t
+++ b/tests/test-merge-halt.t
@@ -162,3 +162,57 @@
   merging b
   $TESTTMP/repo/a *a~base* *a~other* (glob)
   $TESTTMP/repo/b *b~base* *b~other* (glob)
+
+Check that unshelve isn't broken by halting the merge
+  $ cat <> $HGRCPATH
+  > [extensions]
+  > shelve =
+  > EOS
+  $ echo foo > shelve_file1
+  $ echo foo > shelve_file2
+  $ hg ci -qAm foo
+  $ echo bar >> shelve_file1
+  $ echo bar >> shelve_file2
+  $ hg shelve --list
+  $ hg shelve
+  shelved as default
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo baz >> shelve_file1
+  $ echo baz >> shelve_file2
+  $ hg ci -m baz
+  $ hg unshelve --tool false --config merge-tools.false.premerge=keep
+  unshelving change 'default'
+  rebasing shelved changes
+  merging shelve_file1
+  merging shelve_file2
+  merging shelve_file1 failed!
+  merge halted after failed merge (see hg resolve)
+  [240]
+FIXME: This should claim it's in an 'unshelve' state
+  $ hg status --config commands.status.verbose=True
+  M shelve_file1
+  M shelve_file2
+  ? shelve_file1.orig
+  ? shelve_file2.orig
+  # The repository is in an unfinished *update* state.
+  
+  # Unresolved merge conflicts:
+  # 
+  # shelve_file1
+  # shelve_file2
+  # 
+  # To mark files as resolved:  hg resolve --mark FILE
+  
+  # To continue:hg update .
+  
+FIXME: This should not be referencing a stripped commit.
+  $ hg resolve --tool false --all --re-merge
+  abort: unknown revision '4a1d727ea5bb6aed9adfacb2a8f776bae44301d6'
+  [255]
+Ensure the shelve is still around, since we haven't finished the operation yet.
+  $ hg shelve --list
+  default (* ago)changes to: foo (glob)
+FIXME: `hg unshelve --abort` should work.
+  $ hg unshelve --abort
+  abort: no unshelve in progress
+  [20]



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


D11704: dirstate-v2: reorder flag to group related one together

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

REVISION SUMMARY
  Since the format is not frozen yet, it seems like the right moment to do it.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/cext/util.h
  mercurial/helptext/internals/dirstate-v2.txt
  mercurial/pure/parsers.py
  rust/hg-core/src/dirstate_tree/on_disk.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate_tree/on_disk.rs 
b/rust/hg-core/src/dirstate_tree/on_disk.rs
--- a/rust/hg-core/src/dirstate_tree/on_disk.rs
+++ b/rust/hg-core/src/dirstate_tree/on_disk.rs
@@ -105,19 +105,19 @@
 const WDIR_TRACKED = 1 << 0;
 const P1_TRACKED = 1 << 1;
 const P2_INFO = 1 << 2;
-const HAS_MODE_AND_SIZE = 1 << 3;
-const HAS_MTIME = 1 << 4;
-const DIRECTORY = 1 << 5;
-const MODE_EXEC_PERM = 1 << 6;
-const MODE_IS_SYMLINK = 1 << 7;
-const EXPECTED_STATE_IS_MODIFIED = 1 << 8;
-const ALL_UNKNOWN_RECORDED = 1 << 9;
-const ALL_IGNORED_RECORDED = 1 << 10;
-const HAS_FALLBACK_EXEC = 1 << 11;
-const FALLBACK_EXEC = 1 << 12;
-const HAS_FALLBACK_SYMLINK = 1 << 13;
-const FALLBACK_SYMLINK = 1 << 14;
-const MTIME_SECOND_AMBIGUOUS = 1 << 15;
+const MODE_EXEC_PERM = 1 << 3;
+const MODE_IS_SYMLINK = 1 << 4;
+const HAS_FALLBACK_EXEC = 1 <<  5;
+const FALLBACK_EXEC = 1 <<  6;
+const HAS_FALLBACK_SYMLINK = 1 <<  7;
+const FALLBACK_SYMLINK = 1 <<  8;
+const EXPECTED_STATE_IS_MODIFIED = 1 << 9;
+const HAS_MODE_AND_SIZE = 1 <<10;
+const HAS_MTIME = 1 <<11;
+const MTIME_SECOND_AMBIGUOUS = 1 << 12;
+const DIRECTORY = 1 <<13;
+const ALL_UNKNOWN_RECORDED = 1 <<14;
+const ALL_IGNORED_RECORDED = 1 <<15;
 }
 }
 
diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
--- a/mercurial/pure/parsers.py
+++ b/mercurial/pure/parsers.py
@@ -48,19 +48,19 @@
 DIRSTATE_V2_WDIR_TRACKED = 1 << 0
 DIRSTATE_V2_P1_TRACKED = 1 << 1
 DIRSTATE_V2_P2_INFO = 1 << 2
-DIRSTATE_V2_HAS_MODE_AND_SIZE = 1 << 3
-DIRSTATE_V2_HAS_MTIME = 1 << 4
-DIRSTATE_V2_DIRECTORY = 1 << 5
-DIRSTATE_V2_MODE_EXEC_PERM = 1 << 6
-DIRSTATE_V2_MODE_IS_SYMLINK = 1 << 7
-DIRSTATE_V2_EXPECTED_STATE_IS_MODIFIED = 1 << 8
-DIRSTATE_V2_ALL_UNKNOWN_RECORDED = 1 << 9
-DIRSTATE_V2_ALL_IGNORED_RECORDED = 1 << 10
-DIRSTATE_V2_HAS_FALLBACK_EXEC = 1 << 11
-DIRSTATE_V2_FALLBACK_EXEC = 1 << 12
-DIRSTATE_V2_HAS_FALLBACK_SYMLINK = 1 << 13
-DIRSTATE_V2_FALLBACK_SYMLINK = 1 << 14
-DIRSTATE_V2_MTIME_SECOND_AMBIGUOUS = 1 << 15
+DIRSTATE_V2_MODE_EXEC_PERM = 1 << 3
+DIRSTATE_V2_MODE_IS_SYMLINK = 1 << 4
+DIRSTATE_V2_HAS_FALLBACK_EXEC = 1 << 5
+DIRSTATE_V2_FALLBACK_EXEC = 1 << 6
+DIRSTATE_V2_HAS_FALLBACK_SYMLINK = 1 << 7
+DIRSTATE_V2_FALLBACK_SYMLINK = 1 << 8
+DIRSTATE_V2_EXPECTED_STATE_IS_MODIFIED = 1 << 9
+DIRSTATE_V2_HAS_MODE_AND_SIZE = 1 << 10
+DIRSTATE_V2_HAS_MTIME = 1 << 11
+DIRSTATE_V2_MTIME_SECOND_AMBIGUOUS = 1 << 12
+DIRSTATE_V2_DIRECTORY = 1 << 13
+DIRSTATE_V2_ALL_UNKNOWN_RECORDED = 1 << 14
+DIRSTATE_V2_ALL_IGNORED_RECORDED = 1 << 15
 
 
 @attr.s(slots=True, init=False)
diff --git a/mercurial/helptext/internals/dirstate-v2.txt 
b/mercurial/helptext/internals/dirstate-v2.txt
--- a/mercurial/helptext/internals/dirstate-v2.txt
+++ b/mercurial/helptext/internals/dirstate-v2.txt
@@ -378,19 +378,19 @@
 WDIR_TRACKED = 1 << 0
 P1_TRACKED = 1 << 1
 P2_INFO = 1 << 2
-HAS_MODE_AND_SIZE = 1 << 3
-HAS_MTIME = 1 << 4
-DIRECTORY = 1 << 5
-MODE_EXEC_PERM = 1 << 6
-MODE_IS_SYMLINK = 1 << 7
-EXPECTED_STATE_IS_MODIFIED = 1 << 8
-ALL_UNKNOWN_RECORDED = 1 << 9
-ALL_IGNORED_RECORDED = 1 << 10
-HAS_FALLBACK_EXEC = 1 << 11
-FALLBACK_EXEC = 1 << 12
-HAS_FALLBACK_SYMLINK = 1 << 13
-FALLBACK_SYMLINK = 1 << 14
-MTIME_SECOND_AMBIGUOUS = 1 << 15
+MODE_EXEC_PERM = 1 << 3
+MODE_IS_SYMLINK = 1 << 4
+HAS_FALLBACK_EXEC = 1 << 5
+FALLBACK_EXEC = 1 << 6
+HAS_FALLBACK_SYMLINK = 1 << 7
+FALLBACK_SYMLINK = 1 << 8
+EXPECTED_STATE_IS_MODIFIED = 1 << 9
+HAS_MODE_AND_SIZE = 1 << 10
+HAS_MTIME = 1 << 11
+MTIME_SECOND_AMBIGUOUS = 1 << 12
+DIRECTORY = 1 << 13
+ALL_UNKNOWN_RECORDED = 1 << 14
+ALL_IGNORED_RECORDED = 1 << 15
 
   The meaning of each bit is described below.
 
diff --git a/mercurial/cext/util.h b/mercurial/cext/util.h
--- a/mercurial/cext/util.h
+++ b/mercurial/cext/util.h
@@ -32,22 +32,22 @@
 } dirstateItemObject;
 /* clang-format on */
 
-static const int dirstate_flag_wc_tracked = 1;
+static const int dirstate_flag_wc_tracked = 1 << 0;
 static const int dirstate_flag_p1_tracked = 1 << 1;
 static const int dirstate_flag_p2_info = 1 << 2;
-static const int dirstate_flag_has_meaningful_data = 1 << 3;
-static const int dirstate_flag_has_mtime = 1 << 4;
-static const int 

D11703: rust-nodemap: backed out mitigation for issue 6554

2021-10-19 Thread gracinet (Georges Racinet)
gracinet created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is a backout of changeset 3fffb48539ee 
.
  
  Issue 6554 is now considered solved, hence its mitigation
  has to be removed, if only for its performance cost.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-cpython/src/revlog.rs
  tests/test-persistent-nodemap.t

CHANGE DETAILS

diff --git a/tests/test-persistent-nodemap.t b/tests/test-persistent-nodemap.t
--- a/tests/test-persistent-nodemap.t
+++ b/tests/test-persistent-nodemap.t
@@ -435,46 +435,6 @@
   data-length: 121088
   data-unused: 0
   data-unused: 0.000%
-
-Sub-case: fallback for corrupted data file
---
-
-Sabotaging the data file so that nodemap resolutions fail, triggering fallback 
to
-(non-persistent) C implementation.
-
-
-  $ UUID=`hg debugnodemap --metadata| grep 'uid:' | \
-  > sed 's/uid: //'`
-  $ FILE=.hg/store/00changelog-"${UUID}".nd
-  $ python -c "fobj = open('$FILE', 'r+b'); fobj.write(b'\xff' * 121088); 
fobj.close()"
-
-The nodemap data file is still considered in sync with the docket. This
-would fail without the fallback to the (non-persistent) C implementation:
-
-  $ hg log -r b355ef8adce0949b8bdf6afc72ca853740d65944 -T '{rev}\n' --traceback
-  5002
-
-The nodemap data file hasn't been fixed, more tests can be inserted:
-
-  $ hg debugnodemap --dump-disk | f --bytes=256 --hexdump --size
-  size=121088
-  : ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ||
-  0010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ||
-  0020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ||
-  0030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ||
-  0040: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ||
-  0050: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ||
-  0060: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ||
-  0070: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ||
-  0080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ||
-  0090: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ||
-  00a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ||
-  00b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ||
-  00c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ||
-  00d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ||
-  00e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ||
-  00f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ||
-
   $ mv ../tmp-data-file $FILE
   $ mv ../tmp-docket .hg/store/00changelog.n
 
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
@@ -59,22 +59,12 @@
 
 /// Return Revision if found, raises a bare `error.RevlogError`
 /// in case of ambiguity, same as C version does
-def get_rev(, pynode: PyBytes) -> PyResult> {
+def get_rev(, node: PyBytes) -> PyResult> {
 let opt = self.get_nodetree(py)?.borrow();
 let nt = opt.as_ref().unwrap();
 let idx = &*self.cindex(py).borrow();
-let node = node_from_py_bytes(py, )?;
-match nt.find_bin(idx, node.into())
-{
-Ok(None) =>
-// fallback to C implementation, remove once
-// https://bz.mercurial-scm.org/show_bug.cgi?id=6554
-// is fixed (a simple backout should do)
-self.call_cindex(py, "get_rev", ::new(py, 
&[pynode.into_object()]), None)?
-.extract(py),
-Ok(Some(rev)) => Ok(Some(rev)),
-Err(e) => Err(nodemap_error(py, e)),
-}
+let node = node_from_py_bytes(py, )?;
+nt.find_bin(idx, node.into()).map_err(|e| nodemap_error(py, e))
 }
 
 /// same as `get_rev()` but raises a bare `error.RevlogError` if node
@@ -104,34 +94,27 @@
 }
 }
 
-def partialmatch(, pynode: PyObject) -> PyResult> {
+def partialmatch(, node: PyObject) -> PyResult> {
 let opt = self.get_nodetree(py)?.borrow();
 let nt = opt.as_ref().unwrap();
 let idx = &*self.cindex(py).borrow();
 
 let node_as_string = if cfg!(feature = "python3-sys") {
-pynode.cast_as::(py)?.to_string(py)?.to_string()
+node.cast_as::(py)?.to_string(py)?.to_string()
 }
 else {
-let node = pynode.extract::(py)?;
+let node = node.extract::(py)?;
 String::from_utf8_lossy(node.data(py)).to_string()
 };
 
 let prefix = NodePrefix::from_hex(_as_string).map_err(|_| 
PyErr::new::(py, "Invalid 

D11702: dirstate-v2: actually use sub-second mtime precision

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

REVISION SUMMARY
  Instead of zero, set the nanoseconds field to its correct value whenever
  possible and preserve it across serialization+parsing.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/dirstateutils/timestamp.py
  mercurial/dirstateutils/v2.py
  rust/hg-core/src/dirstate/entry.rs
  rust/hg-core/src/dirstate_tree/on_disk.rs
  rust/hg-core/src/dirstate_tree/status.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate_tree/status.rs 
b/rust/hg-core/src/dirstate_tree/status.rs
--- a/rust/hg-core/src/dirstate_tree/status.rs
+++ b/rust/hg-core/src/dirstate_tree/status.rs
@@ -531,9 +531,7 @@
 let mtime_looks_clean;
 if let Some(dirstate_mtime) = entry.truncated_mtime() {
 let fs_mtime = TruncatedTimestamp::for_mtime_of(fs_metadata)
-.expect("OS/libc does not support mtime?")
-// For now don’t use sub-second precision for file mtimes
-.to_integer_second();
+.expect("OS/libc does not support mtime?");
 mtime_looks_clean = fs_mtime.likely_equal(dirstate_mtime)
 && !fs_mtime.likely_equal(self.options.last_normal_time)
 } else {
diff --git a/rust/hg-core/src/dirstate_tree/on_disk.rs 
b/rust/hg-core/src/dirstate_tree/on_disk.rs
--- a/rust/hg-core/src/dirstate_tree/on_disk.rs
+++ b/rust/hg-core/src/dirstate_tree/on_disk.rs
@@ -376,15 +376,7 @@
 // MTIME_SECOND_AMBIGUOUS requires. So we ignore the mtime
 && !self.flags().contains(Flags::MTIME_SECOND_AMBIGUOUS)
 {
-// TODO: replace this by `self.mtime.try_into()?` to use
-// sub-second precision from the file.
-// We don’t do this yet because other parts of the code
-// always set it to zero.
-let mtime = TruncatedTimestamp::from_already_truncated(
-self.mtime.truncated_seconds.get(),
-0,
-)?;
-Some(mtime)
+Some(self.mtime.try_into()?)
 } else {
 None
 };
diff --git a/rust/hg-core/src/dirstate/entry.rs 
b/rust/hg-core/src/dirstate/entry.rs
--- a/rust/hg-core/src/dirstate/entry.rs
+++ b/rust/hg-core/src/dirstate/entry.rs
@@ -91,11 +91,6 @@
 }
 }
 
-pub fn to_integer_second(mut self) -> Self {
-self.nanoseconds = 0;
-self
-}
-
 /// The lower 31 bits of the number of seconds since the epoch.
 pub fn truncated_seconds() -> u32 {
 self.truncated_seconds
diff --git a/mercurial/dirstateutils/v2.py b/mercurial/dirstateutils/v2.py
--- a/mercurial/dirstateutils/v2.py
+++ b/mercurial/dirstateutils/v2.py
@@ -101,15 +101,12 @@
 flags,
 size,
 mtime_s,
-_mtime_ns,
+mtime_ns,
 ) = NODE.unpack(node_bytes)
 
 # Parse child nodes of this node recursively
 parse_nodes(map, copy_map, data, children_start, children_count)
 
-# Don’t yet use sub-second precision if it exists in the file,
-# since other parts of the code still set it to zero.
-mtime_ns = 0
 item = parsers.DirstateItem.from_v2_data(flags, size, mtime_s, 
mtime_ns)
 if not item.any_tracked:
 continue
diff --git a/mercurial/dirstateutils/timestamp.py 
b/mercurial/dirstateutils/timestamp.py
--- a/mercurial/dirstateutils/timestamp.py
+++ b/mercurial/dirstateutils/timestamp.py
@@ -66,12 +66,22 @@
 Takes an `os.stat_result`-like object and returns a `timestamp` object
 for its modification time.
 """
-# https://docs.python.org/2/library/os.html#os.stat_float_times
-# "For compatibility with older Python versions,
-#  accessing stat_result as a tuple always returns integers."
-secs = stat_result[stat.ST_MTIME]
+try:
+# TODO: add this attribute to `osutil.stat` objects,
+# see `mercurial/cext/osutil.c`.
+#
+# This attribute is also not available on Python 2.
+nanos = stat_result.st_mtime_ns
+except AttributeError:
+# https://docs.python.org/2/library/os.html#os.stat_float_times
+# "For compatibility with older Python versions,
+#  accessing stat_result as a tuple always returns integers."
+secs = stat_result[stat.ST_MTIME]
 
-# For now
-subsec_nanos = 0
+subsec_nanos = 0
+else:
+billion = int(1e9)
+secs = nanos // billion
+subsec_nanos = nanos % billion
 
 return timestamp((secs, subsec_nanos))



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


D11700: dirstate-v2: add a new MTIME_SECOND_AMBIGUOUS flags

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

REVISION SUMMARY
  This flag will let us use more `mtime` value in the future.  For now we have a
  minimal handling of the flag at read time, but we will never put ourself in a
  situation where we will needs to writes it.
  
  See the flag documentation for details.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/cext/parsers.c
  mercurial/cext/util.h
  mercurial/helptext/internals/dirstate-v2.txt
  mercurial/pure/parsers.py
  rust/hg-core/src/dirstate_tree/on_disk.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate_tree/on_disk.rs 
b/rust/hg-core/src/dirstate_tree/on_disk.rs
--- a/rust/hg-core/src/dirstate_tree/on_disk.rs
+++ b/rust/hg-core/src/dirstate_tree/on_disk.rs
@@ -117,6 +117,7 @@
 const FALLBACK_EXEC = 1 << 12;
 const HAS_FALLBACK_SYMLINK = 1 << 13;
 const FALLBACK_SYMLINK = 1 << 14;
+const MTIME_SECOND_AMBIGUOUS = 1 << 15;
 }
 }
 
@@ -371,6 +372,9 @@
 };
 let mtime = if self.flags().contains(Flags::HAS_FILE_MTIME)
 && !self.flags().contains(Flags::EXPECTED_STATE_IS_MODIFIED)
+// The current code is not able to do the more subtle comparison 
that the
+// MTIME_SECOND_AMBIGUOUS requires. So we ignore the mtime
+&& !self.flags().contains(Flags::MTIME_SECOND_AMBIGUOUS)
 {
 // TODO: replace this by `self.mtime.try_into()?` to use
 // sub-second precision from the file.
diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
--- a/mercurial/pure/parsers.py
+++ b/mercurial/pure/parsers.py
@@ -60,6 +60,7 @@
 DIRSTATE_V2_FALLBACK_EXEC = 1 << 12
 DIRSTATE_V2_HAS_FALLBACK_SYMLINK = 1 << 13
 DIRSTATE_V2_FALLBACK_SYMLINK = 1 << 14
+DIRSTATE_V2_MTIME_SECOND_AMBIGUOUS = 1 << 15
 
 
 @attr.s(slots=True, init=False)
@@ -140,6 +141,10 @@
 """Build a new DirstateItem object from V2 data"""
 has_mode_size = bool(flags & DIRSTATE_V2_HAS_MODE_AND_SIZE)
 has_meaningful_mtime = bool(flags & DIRSTATE_V2_HAS_FILE_MTIME)
+if flags & DIRSTATE_V2_MTIME_SECOND_AMBIGUOUS:
+# The current code is not able to do the more subtle comparison 
that the
+# MTIME_SECOND_AMBIGUOUS requires. So we ignore the mtime
+has_meaningful_mtime = False
 mode = None
 
 if flags & +DIRSTATE_V2_EXPECTED_STATE_IS_MODIFIED:
diff --git a/mercurial/helptext/internals/dirstate-v2.txt 
b/mercurial/helptext/internals/dirstate-v2.txt
--- a/mercurial/helptext/internals/dirstate-v2.txt
+++ b/mercurial/helptext/internals/dirstate-v2.txt
@@ -390,6 +390,7 @@
 FALLBACK_EXEC = 1 << 12
 HAS_FALLBACK_SYMLINK = 1 << 13
 FALLBACK_SYMLINK = 1 << 14
+MTIME_SECOND_AMBIGUOUS = 1 << 15
 
   The meaning of each bit is described below.
 
@@ -592,3 +593,10 @@
 this entry should be considered a symlink if that information cannot be
 extracted from the file system. If unset it should be considered a normal
 file instead.
+
+`MTIME_SECOND_AMBIGUOUS`
+This flag is relevant only when `HAS_FILE_MTIME` is set.  When set, the
+`mtime` stored in the entry is only valid for comparison with timestamps
+that have nanosecond information. If available timestamp does not carries
+nanosecond information, the `mtime` should be ignored and no optimisation
+can be applied.
diff --git a/mercurial/cext/util.h b/mercurial/cext/util.h
--- a/mercurial/cext/util.h
+++ b/mercurial/cext/util.h
@@ -47,6 +47,7 @@
 static const int dirstate_flag_has_fallback_exec = 1 << 12;
 static const int dirstate_flag_fallback_symlink = 1 << 13;
 static const int dirstate_flag_has_fallback_symlink = 1 << 14;
+static const int dirstate_flag_mtime_second_ambiguous = 1 << 15;
 
 extern PyTypeObject dirstateItemType;
 #define dirstate_tuple_check(op) (Py_TYPE(op) == )
diff --git a/mercurial/cext/parsers.c b/mercurial/cext/parsers.c
--- a/mercurial/cext/parsers.c
+++ b/mercurial/cext/parsers.c
@@ -420,6 +420,14 @@
  dirstate_flag_has_meaningful_data |
  dirstate_flag_has_file_mtime);
}
+   if (t->flags & dirstate_flag_mtime_second_ambiguous) {
+   /* The current code is not able to do the more subtle comparison
+* that the MTIME_SECOND_AMBIGUOUS requires. So we ignore the
+* mtime */
+   t->flags &= ~(dirstate_flag_mtime_second_ambiguous |
+ dirstate_flag_has_meaningful_data |
+ dirstate_flag_has_file_mtime);
+   }
t->mode = 0;
if (t->flags & dirstate_flag_has_meaningful_data) {
if (t->flags & dirstate_flag_mode_exec_perm) {



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

D11701: dirstate: ignore sub-second component when either is zero in mtime

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

REVISION SUMMARY
  When comparing mtimes for equality.
  
  Some APIs simply return zero when more precision is not available.
  When comparing values from different sources, if only one is truncated in
  that way, doing a simple comparison would cause many false negatives.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/cext/parsers.c
  mercurial/dirstateutils/timestamp.py
  mercurial/pure/parsers.py
  rust/hg-core/src/dirstate/entry.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate/entry.rs 
b/rust/hg-core/src/dirstate/entry.rs
--- a/rust/hg-core/src/dirstate/entry.rs
+++ b/rust/hg-core/src/dirstate/entry.rs
@@ -120,9 +120,17 @@
 /// If someone is manipulating the modification times of some files to
 /// intentionally make `hg status` return incorrect results, not truncating
 /// wouldn’t help much since they can set exactly the expected timestamp.
+///
+/// Sub-second precision is ignored if it is zero in either value.
+/// Some APIs simply return zero when more precision is not available.
+/// When comparing values from different sources, if only one is truncated
+/// in that way, doing a simple comparison would cause many false
+/// negatives.
 pub fn likely_equal(self, other: Self) -> bool {
 self.truncated_seconds == other.truncated_seconds
-&& self.nanoseconds == other.nanoseconds
+&& (self.nanoseconds == other.nanoseconds
+|| self.nanoseconds == 0
+|| other.nanoseconds == 0)
 }
 
 pub fn likely_equal_to_mtime_of(
diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
--- a/mercurial/pure/parsers.py
+++ b/mercurial/pure/parsers.py
@@ -302,7 +302,9 @@
 return False
 self_ns = self._mtime_ns
 other_sec, other_ns = other_mtime
-return self_sec == other_sec and self_ns == other_ns
+return self_sec == other_sec and (
+self_ns == other_ns or self_ns == 0 or other_ns == 0
+)
 
 @property
 def state(self):
diff --git a/mercurial/dirstateutils/timestamp.py 
b/mercurial/dirstateutils/timestamp.py
--- a/mercurial/dirstateutils/timestamp.py
+++ b/mercurial/dirstateutils/timestamp.py
@@ -5,15 +5,17 @@
 
 from __future__ import absolute_import
 
+import functools
 import stat
 
 
 rangemask = 0x7FFF
 
 
+@functools.total_ordering
 class timestamp(tuple):
 """
-A Unix timestamp with nanoseconds precision,
+A Unix timestamp with optional nanoseconds precision,
 modulo 2**31 seconds.
 
 A 2-tuple containing:
@@ -22,6 +24,7 @@
 truncated to its lower 31 bits
 
 `subsecond_nanoseconds`: number of nanoseconds since `truncated_seconds`.
+When this is zero, the sub-second precision is considered unknown.
 """
 
 def __new__(cls, value):
@@ -29,6 +32,27 @@
 value = (truncated_seconds & rangemask, subsec_nanos)
 return super(timestamp, cls).__new__(cls, value)
 
+def __eq__(self, other):
+self_secs, self_subsec_nanos = self
+other_secs, other_subsec_nanos = other
+return self_secs == other_secs and (
+self_subsec_nanos == other_subsec_nanos
+or self_subsec_nanos == 0
+or other_subsec_nanos == 0
+)
+
+def __gt__(self, other):
+self_secs, self_subsec_nanos = self
+other_secs, other_subsec_nanos = other
+if self_secs > other_secs:
+return True
+if self_secs < other_secs:
+return False
+if self_subsec_nanos == 0 or other_subsec_nanos == 0:
+# they are considered equal, so not "greater than"
+return False
+return self_subsec_nanos > other_subsec_nanos
+
 
 def zero():
 """
diff --git a/mercurial/cext/parsers.c b/mercurial/cext/parsers.c
--- a/mercurial/cext/parsers.c
+++ b/mercurial/cext/parsers.c
@@ -319,7 +319,9 @@
return NULL;
}
if ((self->flags & dirstate_flag_has_file_mtime) &&
-   self->mtime_s == other_s && self->mtime_ns == other_ns) {
+   self->mtime_s == other_s &&
+   (self->mtime_ns == other_ns || self->mtime_ns == 0 ||
+other_ns == 0)) {
Py_RETURN_TRUE;
} else {
Py_RETURN_FALSE;



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


D11699: dirstate: align Rust function name to `need_delay`

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

REVISION SUMMARY
  The rest of the code use this name. It is not a great name, but it is better 
to
  stay consistent.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/dirstate/entry.rs
  rust/hg-core/src/dirstate_tree/dirstate_map.rs
  rust/hg-cpython/src/dirstate/item.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/dirstate/item.rs 
b/rust/hg-cpython/src/dirstate/item.rs
--- a/rust/hg-cpython/src/dirstate/item.rs
+++ b/rust/hg-cpython/src/dirstate/item.rs
@@ -192,7 +192,7 @@
 }
 
 def need_delay(, now: i32) -> PyResult {
-Ok(self.entry(py).get().mtime_is_ambiguous(now))
+Ok(self.entry(py).get().need_delay(now))
 }
 
 @classmethod
diff --git a/rust/hg-core/src/dirstate_tree/dirstate_map.rs 
b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
@@ -947,7 +947,7 @@
 node.full_path(map.on_disk)?,
 node.copy_source(map.on_disk)?,
 );
-if entry.mtime_is_ambiguous(now) {
+if entry.need_delay(now) {
 ambiguous_mtimes.push(
 node.full_path_borrowed(map.on_disk)?
 .detach_from_tree(),
@@ -991,7 +991,7 @@
 for node in map.iter_nodes() {
 let node = node?;
 if let Some(entry) = node.entry()? {
-if entry.mtime_is_ambiguous(now) {
+if entry.need_delay(now) {
 paths.push(
 node.full_path_borrowed(map.on_disk)?
 .detach_from_tree(),
diff --git a/rust/hg-core/src/dirstate/entry.rs 
b/rust/hg-core/src/dirstate/entry.rs
--- a/rust/hg-core/src/dirstate/entry.rs
+++ b/rust/hg-core/src/dirstate/entry.rs
@@ -576,12 +576,12 @@
 (self.state().into(), self.mode(), self.size(), self.mtime())
 }
 
-pub fn mtime_is_ambiguous(, now: i32) -> bool {
+pub fn need_delay(, now: i32) -> bool {
 self.state() == EntryState::Normal && self.mtime() == now
 }
 
 pub fn clear_ambiguous_mtime( self, now: i32) -> bool {
-let ambiguous = self.mtime_is_ambiguous(now);
+let ambiguous = self.need_delay(now);
 if ambiguous {
 // The file was last modified "simultaneously" with the current
 // write to dirstate (i.e. within the same second for file-



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


D11698: pyoxidizer: update README.md with several small fixes

2021-10-19 Thread spectral (Kyle Lippincott)
spectral created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Currently, pyoxidizer.bzl does not mention the git commit that should be 
checked
  out, so these instructions are a bit difficult to follow right now 
(impossible,
  technically), so I removed the instruction to `git checkout ` and
  the admonition to use a specific version of PyOxidizer. I don't even know if 
the
  project currently builds with the "0.7.0-pre" version that was previously
  recommended.
  
  As fallout from that change to not "pin" to a specific PyOxidizer, I had to
  update the Python version to use when running the tests.
  
  While here, I added a recommendation to use `--release`, as the primary reason
  for this project is performance, and it may have been leaving some on the 
table
  to not have that there.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hgcli/README.md

CHANGE DETAILS

diff --git a/rust/hgcli/README.md b/rust/hgcli/README.md
--- a/rust/hgcli/README.md
+++ b/rust/hgcli/README.md
@@ -12,23 +12,21 @@
 
 # Building
 
-This project currently requires an unreleased version of PyOxidizer
-(0.7.0-pre). For best results, build the exact PyOxidizer commit
-as defined in the `pyoxidizer.bzl` file:
+First, acquire and build a copy of PyOxidizer; you probably want to do this in
+some directory outside of your clone of Mercurial:
 
 $ git clone https://github.com/indygreg/PyOxidizer.git
 $ cd PyOxidizer
-$ git checkout 
 $ cargo build --release
 
-Then build this Rust project using the built `pyoxidizer` executable::
+Then build this Rust project using the built `pyoxidizer` executable:
 
-$ /path/to/pyoxidizer/target/release/pyoxidizer build
+$ /path/to/pyoxidizer/target/release/pyoxidizer build --release
 
 If all goes according to plan, there should be an assembled application
-under `build//debug/app/` with an `hg` executable:
+under `build//release/app/` with an `hg` executable:
 
-$ build/x86_64-unknown-linux-gnu/debug/app/hg version
+$ build/x86_64-unknown-linux-gnu/release/app/hg version
 Mercurial Distributed SCM (version 5.3.1+433-f99cd77d53dc+20200331)
 (see https://mercurial-scm.org for more information)
 
@@ -46,5 +44,5 @@
 to the Mercurial source directory. e.g.:
 
 $ cd /path/to/hg/src/tests
-$ PYTHONPATH=`pwd`/.. python3.7 run-tests.py \
---with-hg 
`pwd`/../rust/hgcli/build/x86_64-unknown-linux-gnu/debug/app/hg
+$ PYTHONPATH=`pwd`/.. python3.9 run-tests.py \
+--with-hg 
`pwd`/../rust/hgcli/build/x86_64-unknown-linux-gnu/release/app/hg



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


D11697: pyoxidizer: disable using in-memory resources

2021-10-19 Thread spectral (Kyle Lippincott)
spectral created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  It's possible that the errors are due to using an incompatible version of
  PyOxidizer; unfortunately the README.md file in this directory says to fetch a
  copy of PyOxidizer matching the commit in this pyoxidizer.bzl file, and yet 
the
  pyoxidizer.bzl file does not actually have a commit mentioned in it.
  
  By disabling in-memory modules, this appears to work on all platforms using 
the
  current head version of PyOxidizer, so let's disable them for now.
  
  Sample error (during `pyoxidizer build`):
  
error[PYOXIDIZER_PYTHON_EXECUTABLE]: adding 
PythonExtensionModule

Caused by:
extension module hgext.fsmonitor.pywatchman.bser cannot be loaded from 
memory but memory loading required
   --> ./pyoxidizer.bzl:140:5
|
140 | exe.add_python_resources(exe.pip_install(["--verbose", ROOT]))
| ^^ 
add_python_resources()


error: adding PythonExtensionModule

Caused by:
extension module hgext.fsmonitor.pywatchman.bser cannot be loaded from 
memory but memory loading required

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hgcli/pyoxidizer.bzl

CHANGE DETAILS

diff --git a/rust/hgcli/pyoxidizer.bzl b/rust/hgcli/pyoxidizer.bzl
--- a/rust/hgcli/pyoxidizer.bzl
+++ b/rust/hgcli/pyoxidizer.bzl
@@ -33,7 +33,8 @@
 TIME_STAMP_SERVER_URL = VARS.get("TIME_STAMP_SERVER_URL", 
"http://timestamp.digicert.com;)
 
 IS_WINDOWS = "windows" in BUILD_TARGET_TRIPLE
-IS_MACOS = "darwin" in BUILD_TARGET_TRIPLE
+
+USE_IN_MEMORY_RESOURCES = False
 
 # Code to run in Python interpreter.
 RUN_CODE = """
@@ -84,7 +85,7 @@
 return default_python_distribution(python_version = "3.9")
 
 def resource_callback(policy, resource):
-if not (IS_WINDOWS or IS_MACOS):
+if USE_IN_MEMORY_RESOURCES:
 resource.add_location = "in-memory"
 return
 
@@ -115,7 +116,7 @@
 # extensions.
 packaging_policy.extension_module_filter = "all"
 packaging_policy.resources_location = "in-memory"
-if IS_WINDOWS or IS_MACOS:
+if not USE_IN_MEMORY_RESOURCES:
 packaging_policy.resources_location_fallback = 
"filesystem-relative:lib"
 packaging_policy.register_resource_callback(resource_callback)
 



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


D11696: rust: Remove now-unused DirstateEntry::clear_ambiguous_mtime method

2021-10-19 Thread SimonSapin
SimonSapin created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/dirstate/entry.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate/entry.rs 
b/rust/hg-core/src/dirstate/entry.rs
--- a/rust/hg-core/src/dirstate/entry.rs
+++ b/rust/hg-core/src/dirstate/entry.rs
@@ -597,23 +597,6 @@
 false
 }
 }
-
-pub fn clear_ambiguous_mtime( self, now: TruncatedTimestamp) -> bool {
-let ambiguous = self.mtime_is_ambiguous(now);
-if ambiguous {
-// The file was last modified "simultaneously" with the current
-// write to dirstate (i.e. within the same second for file-
-// systems with a granularity of 1 sec). This commonly happens
-// for at least a couple of files on 'update'.
-// The user could change the file without changing its size
-// within the same second. Invalidate the file's mtime in
-// dirstate, forcing future 'status' calls to compare the
-// contents of the file if the size is the same. This prevents
-// mistakenly treating such files as clean.
-self.set_possibly_dirty()
-}
-ambiguous
-}
 }
 
 impl EntryState {



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


mercurial-devel | Failed pipeline for branch/default | c3539372

2021-10-19 Thread Heptapod


Pipeline #28006 has failed!

Project: mercurial-devel ( https://foss.heptapod.net/mercurial/mercurial-devel )
Branch: branch/default ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/commits/branch/default )

Commit: c3539372 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/commit/c353937200f25bc398a695f8c897f1cdf332fe08
 )
Commit Message: backout: backed out changeset 2f2107c01dee

Aft...
Commit Author: Raphaël Gomès

Pipeline #28006 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/pipelines/28006 ) 
triggered by Administrator ( https://foss.heptapod.net/root )
had 1 failed job.

Job #255644 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/255644/raw )

Stage: tests
Name: test-py2-rust

-- 
You're receiving this email because of your account on foss.heptapod.net.



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


D11694: dirstate-v2: adjust the meaning of directory flags

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

REVISION SUMMARY
  Tracking directory "explicitly" give use the opportunity to distinct between
  entry that are untracked because they are part of the directory structure and
  entry that are ignored/unknown files on the files system.
  
  The help is adjusted to the new semantic and the code now comply to it for 
both
  read and write.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/cext/parsers.c
  mercurial/cext/util.h
  mercurial/dirstateutils/v2.py
  mercurial/helptext/internals/dirstate-v2.txt
  mercurial/pure/parsers.py
  rust/hg-core/src/dirstate_tree/on_disk.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate_tree/on_disk.rs 
b/rust/hg-core/src/dirstate_tree/on_disk.rs
--- a/rust/hg-core/src/dirstate_tree/on_disk.rs
+++ b/rust/hg-core/src/dirstate_tree/on_disk.rs
@@ -106,8 +106,8 @@
 const P1_TRACKED = 1 << 1;
 const P2_INFO = 1 << 2;
 const HAS_MODE_AND_SIZE = 1 << 3;
-const HAS_FILE_MTIME = 1 << 4;
-const HAS_DIRECTORY_MTIME = 1 << 5;
+const HAS_MTIME = 1 << 4;
+const DIRECTORY = 1 << 5;
 const MODE_EXEC_PERM = 1 << 6;
 const MODE_IS_SYMLINK = 1 << 7;
 const EXPECTED_STATE_IS_MODIFIED = 1 << 8;
@@ -328,16 +328,13 @@
 pub(super) fn cached_directory_mtime(
 ,
 ) -> Result, DirstateV2ParseError> {
-// For now we do not have code to handle ALL_UNKNOWN_RECORDED, so we
-// ignore the mtime if the flag is set.
-if self.flags().contains(Flags::HAS_DIRECTORY_MTIME)
+// For now we do not have code to handle lacks of ALL_UNKNOWN_RECORDED,
+// so we ignore the mtime if the flag is unset.
+if self.flags().contains(Flags::DIRECTORY)
+&& self.flags().contains(Flags::HAS_MTIME)
 && self.flags().contains(Flags::ALL_UNKNOWN_RECORDED)
 {
-if self.flags().contains(Flags::HAS_FILE_MTIME) {
-Err(DirstateV2ParseError)
-} else {
-Ok(Some(self.mtime.try_into()?))
-}
+Ok(Some(self.mtime.try_into()?))
 } else {
 Ok(None)
 }
@@ -369,7 +366,8 @@
 } else {
 None
 };
-let mtime = if self.flags().contains(Flags::HAS_FILE_MTIME)
+let mtime = if self.flags().contains(Flags::HAS_MTIME)
+&& !self.flags().contains(Flags::DIRECTORY)
 && !self.flags().contains(Flags::EXPECTED_STATE_IS_MODIFIED)
 {
 Some(self.mtime.truncated_seconds.into())
@@ -449,7 +447,7 @@
 0.into()
 };
 let mtime = if let Some(m) = mtime_opt {
-flags.insert(Flags::HAS_FILE_MTIME);
+flags.insert(Flags::HAS_MTIME);
 PackedTruncatedTimestamp {
 truncated_seconds: m.into(),
 nanoseconds: 0.into(),
@@ -630,13 +628,14 @@
 // We never set ALL_IGNORED_RECORDED since we
 // don't track that case
 // currently.
-Flags::HAS_DIRECTORY_MTIME
+Flags::DIRECTORY
+| Flags::HAS_MTIME
 | Flags::ALL_UNKNOWN_RECORDED,
 0.into(),
 (*mtime).into(),
 ),
 dirstate_map::NodeData::None => (
-Flags::empty(),
+Flags::DIRECTORY,
 0.into(),
 PackedTruncatedTimestamp::null(),
 ),
diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
--- a/mercurial/pure/parsers.py
+++ b/mercurial/pure/parsers.py
@@ -49,8 +49,8 @@
 DIRSTATE_V2_P1_TRACKED = 1 << 1
 DIRSTATE_V2_P2_INFO = 1 << 2
 DIRSTATE_V2_HAS_MODE_AND_SIZE = 1 << 3
-DIRSTATE_V2_HAS_FILE_MTIME = 1 << 4
-_DIRSTATE_V2_HAS_DIRCTORY_MTIME = 1 << 5  # Unused when Rust is not available
+DIRSTATE_V2_HAS_MTIME = 1 << 4
+DIRSTATE_V2_DIRECTORY = 1 << 5
 DIRSTATE_V2_MODE_EXEC_PERM = 1 << 6
 DIRSTATE_V2_MODE_IS_SYMLINK = 1 << 7
 DIRSTATE_V2_EXPECTED_STATE_IS_MODIFIED = 1 << 8
@@ -137,7 +137,7 @@
 def from_v2_data(cls, flags, size, mtime):
 """Build a new DirstateItem object from V2 data"""
 has_mode_size = bool(flags & DIRSTATE_V2_HAS_MODE_AND_SIZE)
-has_meaningful_mtime = bool(flags & DIRSTATE_V2_HAS_FILE_MTIME)
+has_meaningful_mtime = bool(flags & DIRSTATE_V2_HAS_MTIME)
 mode = None
 
 if flags & +DIRSTATE_V2_EXPECTED_STATE_IS_MODIFIED:
@@ -441,7 +441,7 @@
 if stat.S_ISLNK(self.mode):
 flags |= DIRSTATE_V2_MODE_IS_SYMLINK
 if self._mtime is not None:
-  

D11695: dirstate-v2: read the fallback value in Rust

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

REVISION SUMMARY
  This was overlooked in a previous commit.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/dirstate_tree/on_disk.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate_tree/on_disk.rs 
b/rust/hg-core/src/dirstate_tree/on_disk.rs
--- a/rust/hg-core/src/dirstate_tree/on_disk.rs
+++ b/rust/hg-core/src/dirstate_tree/on_disk.rs
@@ -374,14 +374,26 @@
 } else {
 None
 };
+let fallback_exec = if self.flags().contains(Flags::HAS_FALLBACK_EXEC)
+{
+Some(self.flags().contains(Flags::FALLBACK_EXEC))
+} else {
+None
+};
+let fallback_symlink =
+if self.flags().contains(Flags::HAS_FALLBACK_SYMLINK) {
+Some(self.flags().contains(Flags::FALLBACK_SYMLINK))
+} else {
+None
+};
 DirstateEntry::from_v2_data(
 wdir_tracked,
 p1_tracked,
 p2_info,
 mode_size,
 mtime,
-None,
-None,
+fallback_exec,
+fallback_symlink,
 )
 }
 



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


mercurial-devel | Failed pipeline for branch/default | 74273805

2021-10-19 Thread Heptapod


Pipeline #28001 has failed!

Project: mercurial-devel ( https://foss.heptapod.net/mercurial/mercurial-devel )
Branch: branch/default ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/commits/branch/default )

Commit: 74273805 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/commit/74273805907586ff61db263634036472135cd223
 )
Commit Message: dirstate-v2: preserve the fallback values on di...
Commit Author: Pierre-Yves David ( https://foss.heptapod.net/marmoute )

Pipeline #28001 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/pipelines/28001 ) 
triggered by Raphaël Gomès ( https://foss.heptapod.net/raphael.gomes )
had 4 failed jobs.

Job #255562 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/255562/raw )

Stage: tests
Name: test-py2-chg
Job #29 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/29/raw )

Stage: tests
Name: test-py2-rust
Job #25 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/25/raw )

Stage: tests
Name: test-py2
Job #27 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/27/raw )

Stage: tests
Name: test-py2-pure

-- 
You're receiving this email because of your account on foss.heptapod.net.



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


mercurial-devel | Failed pipeline for branch/default | 6e7b0525

2021-10-19 Thread Heptapod


Pipeline #28000 has failed!

Project: mercurial-devel ( https://foss.heptapod.net/mercurial/mercurial-devel )
Branch: branch/default ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/commits/branch/default )

Commit: 6e7b0525 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/commit/6e7b0525ebfe52f6ccdb3c348cd465dd356a1e9f
 )
Commit Message: dirstate-v2: preserve the fallback values on di...
Commit Author: Pierre-Yves David ( https://foss.heptapod.net/marmoute )

Pipeline #28000 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/pipelines/28000 ) 
triggered by Administrator ( https://foss.heptapod.net/root )
had 6 failed jobs.

Job #255545 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/255545/raw )

Stage: tests
Name: test-py2-chg
Job #255542 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/255542/raw )

Stage: tests
Name: test-py2-rust
Job #255547 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/255547/raw )

Stage: tests
Name: check-pytype-py3
Job #255540 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/255540/raw )

Stage: tests
Name: test-py2-pure
Job #255538 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/255538/raw )

Stage: tests
Name: test-py2
Job #255546 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/255546/raw )

Stage: tests
Name: test-py3-chg

-- 
You're receiving this email because of your account on foss.heptapod.net.



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


D11693: backout: backed out changeset 6edc8800dbc3

2021-10-19 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Same as the previous changeset.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/dispatch.py
  tests/test-chg.t
  tests/test-commandserver.t
  tests/test-nointerrupt.t

CHANGE DETAILS

diff --git a/tests/test-nointerrupt.t b/tests/test-nointerrupt.t
--- a/tests/test-nointerrupt.t
+++ b/tests/test-nointerrupt.t
@@ -66,7 +66,7 @@
   $ sh -c "../send-signal.sh INT" &
   $ hg wait-signal
   interrupted!
-  [250]
+  [255]
 
   $ cat >> $HGRCPATH << EOF
   > [experimental]
@@ -77,7 +77,7 @@
   $ sh -c "../send-signal.sh INT" &
   $ hg wait-signal
   interrupted!
-  [250]
+  [255]
 
   $ cat >> $HGRCPATH << EOF
   > [experimental]
@@ -91,4 +91,4 @@
   press ^C again to terminate immediately (dangerous)
   end of unsafe operation
   interrupted!
-  [250]
+  [255]
diff --git a/tests/test-commandserver.t b/tests/test-commandserver.t
--- a/tests/test-commandserver.t
+++ b/tests/test-commandserver.t
@@ -792,7 +792,7 @@
   *** runcommand debugsuicide
   interrupted!
   killed!
-   [250]
+   [255]
 
 #endif
 
diff --git a/tests/test-chg.t b/tests/test-chg.t
--- a/tests/test-chg.t
+++ b/tests/test-chg.t
@@ -188,12 +188,12 @@
   $ chg bulkwrite --pager=on --color no --config ui.formatted=True
   paged! 'going to write massive data\n'
   killed! (?)
-  [250]
+  [255]
 
   $ chg bulkwrite --pager=on --color no --config ui.formatted=True
   paged! 'going to write massive data\n'
   killed! (?)
-  [250]
+  [255]
 
   $ cd ..
 
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -311,10 +311,7 @@
 except IOError as inst:
 if inst.errno != errno.EPIPE:
 raise
-if req.ui.configbool(b'ui', b'detailed-exit-code'):
-ret = 250
-else:
-ret = -1
+ret = -1
 finally:
 duration = util.timer() - starttime
 req.ui.flush()  # record blocked times



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


D11692: backout: backed out changeset 2f2107c01dee

2021-10-19 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  After discussion on the original phab patch, we've decided to wait until
  Python 2 support is dropped to do this since the behavior differs for
  relatively obscure reasons.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/dispatch.py
  tests/test-pager.t

CHANGE DETAILS

diff --git a/tests/test-pager.t b/tests/test-pager.t
--- a/tests/test-pager.t
+++ b/tests/test-pager.t
@@ -219,7 +219,8 @@
 #endif
 
 A complicated pager command gets worse behavior. Bonus points if you can
-improve this.
+improve this. Windows apparently does this better, but only sometimes?
+#if windows
   $ hg log --limit 3 \
   >   --config pager.pager='this-command-better-never-exist --seriously' \
   >  2>/dev/null || true
@@ -239,6 +240,11 @@
   date:Thu Jan 01 00:00:00 1970 + (?)
   summary: modify a 8 (?)
(?)
+#else
+  $ hg log --limit 3 \
+  >   --config pager.pager='this-command-better-never-exist --seriously' \
+  >  2>/dev/null || true
+#endif
 
 Pager works with shell aliases.
 
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -252,14 +252,9 @@
 err = e
 status = -1
 
-# Somehow we have to catcht he exception here; catching it inside
-# _flushstdio() doesn't work.
-try:
-ret = _flushstdio(req.ui, err)
-if ret and not status:
-status = ret
-except BaseException:
-pass
+ret = _flushstdio(req.ui, err)
+if ret and not status:
+status = ret
 return status
 
 
@@ -322,10 +317,7 @@
 ret = -1
 finally:
 duration = util.timer() - starttime
-try:
-req.ui.flush()  # record blocked times
-except BaseException:
-pass
+req.ui.flush()  # record blocked times
 if req.ui.logblockedtimes:
 req.ui._blockedtimes[b'command_duration'] = duration * 1000
 req.ui.log(
@@ -349,10 +341,7 @@
 except:  # exiting, so no re-raises
 ret = ret or -1
 # do flush again since ui.log() and exit handlers may write to ui
-try:
-req.ui.flush()
-except BaseException:
-pass
+req.ui.flush()
 return ret
 
 
@@ -473,10 +462,7 @@
 try:
 return _dispatch(req)
 finally:
-try:
-ui.flush()  # record blocked times
-except BaseException:
-pass
+ui.flush()
 except:  # re-raises
 # enter the debugger when we hit an exception
 if req.earlyoptions[b'debugger']:



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


D11691: dirstate: rename a `very_likely_equal` method to `likely_equal`

2021-10-19 Thread SimonSapin
SimonSapin created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  No need to oversell it.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate_tree/status.rs 
b/rust/hg-core/src/dirstate_tree/status.rs
--- a/rust/hg-core/src/dirstate_tree/status.rs
+++ b/rust/hg-core/src/dirstate_tree/status.rs
@@ -200,7 +200,7 @@
 // directory eligible for `read_dir` caching.
 if let Some(meta) = directory_metadata {
 if cached_mtime
-.very_likely_equal_to_mtime_of(meta)
+.likely_equal_to_mtime_of(meta)
 .unwrap_or(false)
 {
 // The mtime of that directory has not changed
@@ -471,7 +471,7 @@
 let is_up_to_date = if let Some(cached) =
 dirstate_node.cached_directory_mtime()?
 {
-cached.very_likely_equal(truncated)
+cached.likely_equal(truncated)
 } else {
 false
 };
diff --git a/rust/hg-core/src/dirstate/entry.rs 
b/rust/hg-core/src/dirstate/entry.rs
--- a/rust/hg-core/src/dirstate/entry.rs
+++ b/rust/hg-core/src/dirstate/entry.rs
@@ -110,16 +110,16 @@
 /// If someone is manipulating the modification times of some files to
 /// intentionally make `hg status` return incorrect results, not truncating
 /// wouldn’t help much since they can set exactly the expected timestamp.
-pub fn very_likely_equal(self, other: Self) -> bool {
+pub fn likely_equal(self, other: Self) -> bool {
 self.truncated_seconds == other.truncated_seconds
 && self.nanoseconds == other.nanoseconds
 }
 
-pub fn very_likely_equal_to_mtime_of(
+pub fn likely_equal_to_mtime_of(
 self,
 metadata: ::Metadata,
 ) -> io::Result {
-Ok(self.very_likely_equal(Self::for_mtime_of(metadata)?))
+Ok(self.likely_equal(Self::for_mtime_of(metadata)?))
 }
 }
 



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


mercurial-devel | Failed pipeline for branch/default | 37c0ec55

2021-10-19 Thread Heptapod


Pipeline #27994 has failed!

Project: mercurial-devel ( https://foss.heptapod.net/mercurial/mercurial-devel )
Branch: branch/default ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/commits/branch/default )

Commit: 37c0ec55 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/commit/37c0ec55e7abcfbc08b64e7806ac5247ac2e95ad
 )
Commit Message: backout: backed out changeset 2f2107c01dee (+1 ...
Commit Author: Raphaël Gomès

Pipeline #27994 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/pipelines/27994 ) 
triggered by Administrator ( https://foss.heptapod.net/root )
had 1 failed job.

Job #255490 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/255490/raw )

Stage: tests
Name: test-py2-chg

-- 
You're receiving this email because of your account on foss.heptapod.net.



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


D11690: python: compatibility for python 3.11 (issue6604)

2021-10-19 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The `unittest._TextTestResult` alias has been removed.
  The "new" name has been available since 3.2, and we only support 3.5.3+.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  tests/basic_test_result.py
  tests/run-tests.py

CHANGE DETAILS

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -2233,12 +2233,15 @@
 firstlock = threading.RLock()
 firsterror = False
 
-
-class TestResult(unittest._TextTestResult):
+if PYTHON3:
+base_class = unittest.TextTestResult
+else:
+base_class = unittest._TextTestResult
+
+
+class TestResult(base_class):
 """Holds results when executing via unittest."""
 
-# Don't worry too much about accessing the non-public _TextTestResult.
-# It is relatively common in Python testing tools.
 def __init__(self, options, *args, **kwargs):
 super(TestResult, self).__init__(*args, **kwargs)
 
diff --git a/tests/basic_test_result.py b/tests/basic_test_result.py
--- a/tests/basic_test_result.py
+++ b/tests/basic_test_result.py
@@ -1,9 +1,15 @@
 from __future__ import absolute_import, print_function
 
+import sys
 import unittest
 
+if sys.version_info[0] < 3:
+base_class = unittest._TextTestResult
+else:
+base_class = unittest.TextTestResult
 
-class TestResult(unittest._TextTestResult):
+
+class TestResult(base_class):
 def __init__(self, options, *args, **kwargs):
 super(TestResult, self).__init__(*args, **kwargs)
 self._options = options



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


mercurial-devel | Failed pipeline for branch/default | a5a5c3d8

2021-10-19 Thread Heptapod


Pipeline #27987 has failed!

Project: mercurial-devel ( https://foss.heptapod.net/mercurial/mercurial-devel )
Branch: branch/default ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/commits/branch/default )

Commit: a5a5c3d8 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/commit/a5a5c3d85574bcaa248b4fc6f56362ddaddbae64
 )
Commit Message: Backed out changeset 2f2107c01dee

Following di...
Commit Author: Raphaël Gomès

Pipeline #27987 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/pipelines/27987 ) 
triggered by Administrator ( https://foss.heptapod.net/root )
had 3 failed jobs.

Job #255433 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/255433/raw )

Stage: tests
Name: test-py3-chg
Job #255422 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/255422/raw )

Stage: tests
Name: checks-py3
Job #255421 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/255421/raw )

Stage: tests
Name: checks-py2

-- 
You're receiving this email because of your account on foss.heptapod.net.



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


mercurial-devel | Failed pipeline for branch/stable | 35e44e86

2021-10-19 Thread Heptapod


Pipeline #27985 has failed!

Project: mercurial-devel ( https://foss.heptapod.net/mercurial/mercurial-devel )
Branch: branch/stable ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/commits/branch/stable )

Commit: 35e44e86 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/commit/35e44e86e802e7cfa0b1cf8909733dd6a8d9167a
 )
Commit Message: rewrite: fix issue6599

Explanation inside.

Di...
Commit Author: Raphaël Gomès

Pipeline #27985 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/pipelines/27985 ) 
triggered by Administrator ( https://foss.heptapod.net/root )
had 1 failed job.

Job #255398 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/255398/raw )

Stage: tests
Name: test-py2-chg

-- 
You're receiving this email because of your account on foss.heptapod.net.



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


D11689: rhg: simplify split_metadata

2021-10-19 Thread aalekseyev (Arseniy Alekseyev)
aalekseyev created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  It turns out that it's possible to implement `FilelogEntry.into_data`
  on top of `split`, as proposed by @spectral.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

CHANGE DETAILS

diff --git a/rust/hg-core/src/revlog/filelog.rs 
b/rust/hg-core/src/revlog/filelog.rs
--- a/rust/hg-core/src/revlog/filelog.rs
+++ b/rust/hg-core/src/revlog/filelog.rs
@@ -54,28 +54,18 @@
 
 impl FilelogEntry {
 /// Split into metadata and data
-/// Returns None if there is no metadata, so the entire entry is data.
-fn split_metadata() -> Result, HgError> {
+pub fn split() -> Result<(Option<&[u8]>, &[u8]), HgError> {
 const DELIMITER: &[u8; 2] = &[b'\x01', b'\n'];
 
 if let Some(rest) = self.0.drop_prefix(DELIMITER) {
 if let Some((metadata, data)) = rest.split_2_by_slice(DELIMITER) {
-Ok(Some((metadata, data)))
+Ok((Some(metadata), data))
 } else {
 Err(HgError::corrupted(
 "Missing metadata end delimiter in filelog entry",
 ))
 }
 } else {
-Ok(None)
-}
-}
-
-/// Split into metadata and data
-pub fn split() -> Result<(Option<&[u8]>, &[u8]), HgError> {
-if let Some((metadata, data)) = self.split_metadata()? {
-Ok((Some(metadata), data))
-} else {
 Ok((None, ))
 }
 }
@@ -89,7 +79,7 @@
 /// Consume the entry, and convert it into data, discarding any metadata,
 /// if present.
 pub fn into_data(self) -> Result, HgError> {
-if let Some((_metadata, data)) = self.split_metadata()? {
+if let (Some(_metadata), data) = self.split()? {
 Ok(data.to_owned())
 } else {
 Ok(self.0)



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