Re: [PATCH] makefile: run Rust tests if cargo is installed

2019-08-21 Thread Raphaël Gomès
I'm not sure I agree, checking for execute this way seems very common 
and looks more semantic to me.


On 8/22/19 1:37 AM, Yuya Nishihara wrote:

On Thu, 22 Aug 2019 08:31:50 +0900, Yuya Nishihara wrote:

On Wed, 21 Aug 2019 18:09:33 +0200, Raphaël Gomès wrote:

# HG changeset patch
# User Raphaël Gomès 
# Date 1566403010 -7200
#  Wed Aug 21 17:56:50 2019 +0200
# Branch stable
# Node ID 5b9efc6098154fb5079f06b3c485b58363e0f43d
# Parent  302dbc9d52beeb2ef677aa18b3fa005bbce2134e
makefile: run Rust tests if cargo is installed

While no particular minimum toolchain version is targeted as of yet, this
serves as a first step to make more people/machines run the Rust tests.

diff -r 302dbc9d52be -r 5b9efc609815 Makefile
--- a/Makefile  Fri Aug 16 15:41:53 2019 +0300
+++ b/Makefile  Wed Aug 21 17:56:50 2019 +0200
@@ -110,8 +110,11 @@
  check: tests
  
  tests:

-   cd tests && $(PYTHON) run-tests.py $(TESTFLAGS)
-
+   if [ -x "$$(command -v cargo)" ]; then \

And maybe -n ?. '-x ""' (empty string) seems wrong.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

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


Re: [PATCH] makefile: run Rust tests if cargo is installed

2019-08-21 Thread Anton Shestakov
On Wed, 21 Aug 2019 18:09:33 +0200
Raphaël Gomès  wrote:

> # HG changeset patch
> # User Raphaël Gomès 
> # Date 1566403010 -7200
> #  Wed Aug 21 17:56:50 2019 +0200
> # Branch stable
> # Node ID 5b9efc6098154fb5079f06b3c485b58363e0f43d
> # Parent  302dbc9d52beeb2ef677aa18b3fa005bbce2134e
> makefile: run Rust tests if cargo is installed
> 
> While no particular minimum toolchain version is targeted as of yet, this
> serves as a first step to make more people/machines run the Rust tests.
> 
> diff -r 302dbc9d52be -r 5b9efc609815 Makefile
> --- a/MakefileFri Aug 16 15:41:53 2019 +0300
> +++ b/MakefileWed Aug 21 17:56:50 2019 +0200
> @@ -110,8 +110,11 @@
>  check: tests
>  
>  tests:
> - cd tests && $(PYTHON) run-tests.py $(TESTFLAGS)
> -
> + if [ -x "$$(command -v cargo)" ]; then \
> + # Run Rust tests if cargo is installed
> + cd $(HGROOT)/rust/hg-cpython && cargo test --quiet --all; \
> + fi;
> + cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) && \
>  test-%:

I most likely forgot all the intricacies of make syntax, but this looks
like a shell command is getting chained by && with a make target?

Also an unrelated change removes an empty line between "tests" and
"test-%" targets.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] makefile: run Rust tests if cargo is installed

2019-08-21 Thread Yuya Nishihara
On Thu, 22 Aug 2019 08:31:50 +0900, Yuya Nishihara wrote:
> On Wed, 21 Aug 2019 18:09:33 +0200, Raphaël Gomès wrote:
> > # HG changeset patch
> > # User Raphaël Gomès 
> > # Date 1566403010 -7200
> > #  Wed Aug 21 17:56:50 2019 +0200
> > # Branch stable
> > # Node ID 5b9efc6098154fb5079f06b3c485b58363e0f43d
> > # Parent  302dbc9d52beeb2ef677aa18b3fa005bbce2134e
> > makefile: run Rust tests if cargo is installed
> > 
> > While no particular minimum toolchain version is targeted as of yet, this
> > serves as a first step to make more people/machines run the Rust tests.
> > 
> > diff -r 302dbc9d52be -r 5b9efc609815 Makefile
> > --- a/Makefile  Fri Aug 16 15:41:53 2019 +0300
> > +++ b/Makefile  Wed Aug 21 17:56:50 2019 +0200
> > @@ -110,8 +110,11 @@
> >  check: tests
> >  
> >  tests:
> > -   cd tests && $(PYTHON) run-tests.py $(TESTFLAGS)
> > -
> > +   if [ -x "$$(command -v cargo)" ]; then \

And maybe -n ?. '-x ""' (empty string) seems wrong.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] makefile: run Rust tests if cargo is installed

2019-08-21 Thread Yuya Nishihara
On Wed, 21 Aug 2019 18:09:33 +0200, Raphaël Gomès wrote:
> # HG changeset patch
> # User Raphaël Gomès 
> # Date 1566403010 -7200
> #  Wed Aug 21 17:56:50 2019 +0200
> # Branch stable
> # Node ID 5b9efc6098154fb5079f06b3c485b58363e0f43d
> # Parent  302dbc9d52beeb2ef677aa18b3fa005bbce2134e
> makefile: run Rust tests if cargo is installed
> 
> While no particular minimum toolchain version is targeted as of yet, this
> serves as a first step to make more people/machines run the Rust tests.
> 
> diff -r 302dbc9d52be -r 5b9efc609815 Makefile
> --- a/MakefileFri Aug 16 15:41:53 2019 +0300
> +++ b/MakefileWed Aug 21 17:56:50 2019 +0200
> @@ -110,8 +110,11 @@
>  check: tests
>  
>  tests:
> - cd tests && $(PYTHON) run-tests.py $(TESTFLAGS)
> -
> + if [ -x "$$(command -v cargo)" ]; then \
> + # Run Rust tests if cargo is installed
> + cd $(HGROOT)/rust/hg-cpython && cargo test --quiet --all; \
> + fi;

Perhaps, we'll want to specify $(CARGO) command to be used.

  $ make CARGO='rustup run nightly cargo'

  # in Makefile, provide the default
  CARGO = cargo
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6755: merge: hint about using `hg resolve` for resolving conflicts

2019-08-21 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This was suggested by one of our users at Google. Makes sense to me.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/merge.py
  tests/test-rebase-inmemory.t
  tests/test-resolve.t

CHANGE DETAILS

diff --git a/tests/test-resolve.t b/tests/test-resolve.t
--- a/tests/test-resolve.t
+++ b/tests/test-resolve.t
@@ -210,12 +210,15 @@
   [1]
   $ hg up 0
   abort: outstanding merge conflicts
+  (use 'hg resolve' to resolve)
   [255]
   $ hg merge 2
   abort: outstanding merge conflicts
+  (use 'hg resolve' to resolve)
   [255]
   $ hg merge --force 2
   abort: outstanding merge conflicts
+  (use 'hg resolve' to resolve)
   [255]
 
 set up conflict-free merge
diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -506,6 +506,7 @@
   $ hg rebase -s 2 -d 7
   rebasing 2:177f92b77385 "c"
   abort: outstanding merge conflicts
+  (use 'hg resolve' to resolve)
   [255]
   $ hg resolve -l
   U e
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -2025,7 +2025,8 @@
 raise error.Abort(_("outstanding uncommitted merge"))
 ms = mergestate.read(repo)
 if list(ms.unresolved()):
-raise error.Abort(_("outstanding merge conflicts"))
+raise error.Abort(_("outstanding merge conflicts"),
+  hint=_("use 'hg resolve' to resolve"))
 if branchmerge:
 if pas == [p2]:
 raise error.Abort(_("merging with a working directory ancestor"



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


Re: [PATCH] makefile: run Rust tests if cargo is installed

2019-08-21 Thread Raphaël Gomès
I figured patchbomb would add [PATCH STABLE], but I was wrong, it has to 
be specified. So this patch is for the stable branch.


On 8/21/19 6:09 PM, Raphaël Gomès wrote:

# HG changeset patch
# User Raphaël Gomès 
# Date 1566403010 -7200
#  Wed Aug 21 17:56:50 2019 +0200
# Branch stable
# Node ID 5b9efc6098154fb5079f06b3c485b58363e0f43d
# Parent  302dbc9d52beeb2ef677aa18b3fa005bbce2134e
makefile: run Rust tests if cargo is installed

While no particular minimum toolchain version is targeted as of yet, this
serves as a first step to make more people/machines run the Rust tests.

diff -r 302dbc9d52be -r 5b9efc609815 Makefile
--- a/Makefile  Fri Aug 16 15:41:53 2019 +0300
+++ b/Makefile  Wed Aug 21 17:56:50 2019 +0200
@@ -110,8 +110,11 @@
  check: tests
  
  tests:

-   cd tests && $(PYTHON) run-tests.py $(TESTFLAGS)
-
+   if [ -x "$$(command -v cargo)" ]; then \
+   # Run Rust tests if cargo is installed
+   cd $(HGROOT)/rust/hg-cpython && cargo test --quiet --all; \
+   fi;
+   cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) && \
  test-%:
cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) $@
  
___

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

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


[PATCH] makefile: run Rust tests if cargo is installed

2019-08-21 Thread Raphaël Gomès
# HG changeset patch
# User Raphaël Gomès 
# Date 1566403010 -7200
#  Wed Aug 21 17:56:50 2019 +0200
# Branch stable
# Node ID 5b9efc6098154fb5079f06b3c485b58363e0f43d
# Parent  302dbc9d52beeb2ef677aa18b3fa005bbce2134e
makefile: run Rust tests if cargo is installed

While no particular minimum toolchain version is targeted as of yet, this
serves as a first step to make more people/machines run the Rust tests.

diff -r 302dbc9d52be -r 5b9efc609815 Makefile
--- a/Makefile  Fri Aug 16 15:41:53 2019 +0300
+++ b/Makefile  Wed Aug 21 17:56:50 2019 +0200
@@ -110,8 +110,11 @@
 check: tests
 
 tests:
-   cd tests && $(PYTHON) run-tests.py $(TESTFLAGS)
-
+   if [ -x "$$(command -v cargo)" ]; then \
+   # Run Rust tests if cargo is installed
+   cd $(HGROOT)/rust/hg-cpython && cargo test --quiet --all; \
+   fi;
+   cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) && \
 test-%:
cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) $@
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6732: localrepo: push manifestlog and changelog construction code into store

2019-08-21 Thread indygreg (Gregory Szorc)
This revision is now accepted and ready to land.
indygreg added a comment.
indygreg accepted this revision.


  The boundary between `localrepository` and `store` is a bit murky and 
definitely needs some work. When I last had things paged into my brain last 
year, I think I was trending towards breaking up the store into discrete 
classes and making the code that dynamically resolves repository types cherry 
pick the classes depending on the opener options. But we could easily have the 
store handle this logic as well. This is all very complicated and I don't 
prescribe to have a single correct answer.

REPOSITORY
  rHG Mercurial

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

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

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


Re: [PATCH 11 of 11] rust-dirstate: remove test case for DirsMultiset::new(Manifest, Some)

2019-08-21 Thread Pulkit Goyal
On Sat, Aug 17, 2019 at 3:49 PM Yuya Nishihara  wrote:
>
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1566034135 -32400
> #  Sat Aug 17 18:28:55 2019 +0900
> # Node ID 24f0204173d07b53cdd34b75122b46cd74df3756
> # Parent  c0660c41e5b27173f73b8c88da1728b69425aeba
> rust-dirstate: remove test case for DirsMultiset::new(Manifest, Some)
>
> It's no longer possible.

Queued the series, many thanks. Also, thanks to Raphaёl for the review.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 07 of 11] rust: simply use TryInto to convert slice to array

2019-08-21 Thread Raphaël Gomès
Indeed. I think I wrote this function before TryInto was on Debian 
stable's Rust version.


On 8/17/19 2:12 PM, Yuya Nishihara wrote:


# HG changeset patch
# User Yuya Nishihara 
# Date 1566009462 -32400
#  Sat Aug 17 11:37:42 2019 +0900
# Node ID d496a0a5d5f8ff45afde5a0a90b0917e507c
# Parent  a57c56ff9cec59f12780c83f5dc2ab679d2523e6
rust: simply use TryInto to convert slice to array

Since our rust module depends on TryInto, there's no point to avoid using it.

While rewriting copy_into_array(), I noticed CPython interface doesn't check
the length of the p1/p2 values, which is marked as TODO.

diff --git a/rust/hg-core/src/dirstate/dirstate_map.rs 
b/rust/hg-core/src/dirstate/dirstate_map.rs
--- a/rust/hg-core/src/dirstate/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate/dirstate_map.rs
@@ -7,13 +7,13 @@
  
  use crate::{

  dirstate::{parsers::PARENT_SIZE, EntryState},
-pack_dirstate, parse_dirstate,
-utils::copy_into_array,
-CopyMap, DirsIterable, DirsMultiset, DirstateEntry, DirstateError,
-DirstateMapError, DirstateParents, DirstateParseError, StateMap,
+pack_dirstate, parse_dirstate, CopyMap, DirsIterable, DirsMultiset,
+DirstateEntry, DirstateError, DirstateMapError, DirstateParents,
+DirstateParseError, StateMap,
  };
  use core::borrow::Borrow;
  use std::collections::{HashMap, HashSet};
+use std::convert::TryInto;
  use std::iter::FromIterator;
  use std::ops::Deref;
  use std::time::Duration;
@@ -260,10 +260,10 @@ impl DirstateMap {
  let parents;
  if file_contents.len() == PARENT_SIZE * 2 {
  parents = DirstateParents {
-p1: copy_into_array(_contents[..PARENT_SIZE]),
-p2: copy_into_array(
-_contents[PARENT_SIZE..PARENT_SIZE * 2],
-),
+p1: file_contents[..PARENT_SIZE].try_into().unwrap(),
+p2: file_contents[PARENT_SIZE..PARENT_SIZE * 2]
+.try_into()
+.unwrap(),
  };
  } else if file_contents.is_empty() {
  parents = DirstateParents {
diff --git a/rust/hg-core/src/dirstate/parsers.rs 
b/rust/hg-core/src/dirstate/parsers.rs
--- a/rust/hg-core/src/dirstate/parsers.rs
+++ b/rust/hg-core/src/dirstate/parsers.rs
@@ -5,7 +5,6 @@
  
  use crate::{

  dirstate::{CopyMap, EntryState, StateMap},
-utils::copy_into_array,
  DirstateEntry, DirstatePackError, DirstateParents, DirstateParseError,
  };
  use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
@@ -31,8 +30,8 @@ pub fn parse_dirstate(
  
  let mut curr_pos = PARENT_SIZE * 2;

  let parents = DirstateParents {
-p1: copy_into_array([..PARENT_SIZE]),
-p2: copy_into_array([PARENT_SIZE..curr_pos]),
+p1: contents[..PARENT_SIZE].try_into().unwrap(),
+p2: contents[PARENT_SIZE..curr_pos].try_into().unwrap(),
  };
  
  while curr_pos < contents.len() {

diff --git a/rust/hg-core/src/utils.rs b/rust/hg-core/src/utils.rs
--- a/rust/hg-core/src/utils.rs
+++ b/rust/hg-core/src/utils.rs
@@ -9,23 +9,6 @@
  
  pub mod files;
  
-use std::convert::AsMut;

-
-/// Takes a slice and copies it into an array.
-///
-/// # Panics
-///
-/// Will panic if the slice and target array don't have the same length.
-pub fn copy_into_array(slice: &[T]) -> A
-where
-A: Sized + Default + AsMut<[T]>,
-T: Copy,
-{
-let mut a = Default::default();
->::as_mut( a).copy_from_slice(slice);
-a
-}
-
  /// Replaces the `from` slice with the `to` slice inside the `buf` slice.
  ///
  /// # Examples
diff --git a/rust/hg-cpython/src/dirstate/dirstate_map.rs 
b/rust/hg-cpython/src/dirstate/dirstate_map.rs
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs
+++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs
@@ -24,7 +24,7 @@ use crate::{
  ref_sharing::PySharedState,
  };
  use hg::{
-utils::copy_into_array, DirsIterable, DirsMultiset, DirstateEntry,
+DirsIterable, DirsMultiset, DirstateEntry,
  DirstateMap as RustDirstateMap, DirstateParents, DirstateParseError,
  EntryState,
  };
@@ -239,8 +239,9 @@ py_class!(pub class DirstateMap |py| {
  }
  
  def setparents(, p1: PyObject, p2: PyObject) -> PyResult {

-let p1 = copy_into_array(p1.extract::(py)?.data(py));
-let p2 = copy_into_array(p2.extract::(py)?.data(py));
+// TODO: don't panic; raise Python exception instead.
+let p1 = p1.extract::(py)?.data(py).try_into().unwrap();
+let p2 = p2.extract::(py)?.data(py).try_into().unwrap();
  
  self.inner(py)

  .borrow_mut()
@@ -274,8 +275,9 @@ py_class!(pub class DirstateMap |py| {
  ) -> PyResult {
  let now = Duration::new(now.extract(py)?, 0);
  let parents = DirstateParents {
-p1: copy_into_array(p1.extract::(py)?.data(py)),
-p2: copy_into_array(p2.extract::(py)?.data(py)),
+// TODO: don't panic; raise Python exception instead.
+

Re: [PATCH 11 of 11] rust-dirstate: remove test case for DirsMultiset::new(Manifest, Some)

2019-08-21 Thread Raphaël Gomès

The entire series looks good to me.

On 8/17/19 2:12 PM, Yuya Nishihara wrote:

# HG changeset patch
# User Yuya Nishihara 
# Date 1566034135 -32400
#  Sat Aug 17 18:28:55 2019 +0900
# Node ID 24f0204173d07b53cdd34b75122b46cd74df3756
# Parent  c0660c41e5b27173f73b8c88da1728b69425aeba
rust-dirstate: remove test case for DirsMultiset::new(Manifest, Some)

It's no longer possible.

diff --git a/rust/hg-core/src/dirstate/dirs_multiset.rs 
b/rust/hg-core/src/dirstate/dirs_multiset.rs
--- a/rust/hg-core/src/dirstate/dirs_multiset.rs
+++ b/rust/hg-core/src/dirstate/dirs_multiset.rs
@@ -283,24 +283,6 @@ mod tests {
  
  #[test]

  fn test_dirsmultiset_new_skip() {
-let input_vec = ["a/", "b/", "a/c", "a/d/"]
-.iter()
-.map(|e| e.as_bytes().to_vec())
-.collect();
-let expected_inner = [("", 2), ("a", 3), ("b", 1), ("a/d", 1)]
-.iter()
-.map(|(k, v)| (k.as_bytes().to_vec(), *v))
-.collect();
-
-// this was
-// DirsMultiset::new(Manifest(_vec), Some(EntryState::Normal))
-let new = DirsMultiset::from_manifest(_vec);
-let expected = DirsMultiset {
-inner: expected_inner,
-};
-// Skip does not affect a manifest
-assert_eq!(expected, new);
-
  let input_map = [
  ("a/", EntryState::Normal),
  ("a/b/", EntryState::Normal),
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

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


Re: [PATCH 7 of 7] revlog: split `rawtext` retrieval out of _revisiondata

2019-08-21 Thread Yuya Nishihara
On Tue, 20 Aug 2019 18:37:32 +0200, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David 
> # Date 1566313956 -7200
> #  Tue Aug 20 17:12:36 2019 +0200
> # Node ID 9f906301d3f152b00935a519fafc216499ead4df
> # Parent  5b8bcfd5ef2cb077fe3c8bd2c4f62f693ebcf2fc
> # EXP-Topic revisiondata
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
> 9f906301d3f1
> revlog: split `rawtext` retrieval out of _revisiondata

Queued the series, thanks.

> +if raw and validated:
> +# if we are don't want to process the raw text and that raw
> +# text is cached, we can exit early.
> +return rawtext
> +if rev is None:
> +rev = self.rev(node)
> +# the revlog's flag for this revision
> +# (usually alter its state or content)
> +flags = self.flags(rev)
> +
> +if validated and flags == REVIDX_DEFAULT_FLAGS:
> +# no extra flags set, no flag processor runs, text = rawtext
> +return rawtext
> +
> +text, validatehash = self._processflags(rawtext, flags, 'read', 
> raw=raw)
> +if validatehash:
> +self.checkhash(text, node, rev=rev)
> +if not validated:
> +self._revisioncache = (node, rev, rawtext)

Maybe better to comment why updating cache if "not validated" as it
depends on internal behavior of _rawtext().

> +def _rawtext(self, node, rev, _df=None):
> +"""return the possibly unvalidated rawtext for a revision

Nit: unvalidated sounds odd, but I don't know the right word.

> +returns is (rev, rawtext, validated)

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


Re: [PATCH 5 of 7] revlog: add some documentation to `_revisiondata` code

2019-08-21 Thread Yuya Nishihara
On Tue, 20 Aug 2019 18:37:30 +0200, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David 
> # Date 1565214901 -7200
> #  Wed Aug 07 23:55:01 2019 +0200
> # Node ID b8286cf6ab132b2d132e1565bc7bc100b4c69596
> # Parent  8dd3d57f5d4780a1c8e6aeccc78c54c856999215
> # EXP-Topic revisiondata
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
> b8286cf6ab13
> revlog: add some documentation to `_revisiondata` code
> 
> diff --git a/mercurial/revlog.py b/mercurial/revlog.py
> --- a/mercurial/revlog.py
> +++ b/mercurial/revlog.py
> @@ -1611,6 +1611,7 @@ class revlog(object):
>  return self._revisiondata(nodeorrev, _df, raw=raw)
>  
>  def _revisiondata(self, nodeorrev, _df=None, raw=False):
> +# deal with  argument type
>  if isinstance(nodeorrev, int):
>  rev = nodeorrev
>  node = self.node(rev)
> @@ -1618,19 +1619,31 @@ class revlog(object):
>  node = nodeorrev
>  rev = None
>  
> +# fast path the special `nullid` rev
>  if node == nullid:
>  return ""
>  
> +# revision in the cache (could be useful to apply delta)
>  cachedrev = None
> +# the revlog's flag for this revision
> +# (usually alter its state or content)
>  flags = None
> +# The text as stored inside the revlog. Might be the revision or 
> might
> +# need to be processed to retrieve the revision.
>  rawtext = None
> +# An intermediate text to apply deltas to
>  basetext = None
> +
> +# Check is we are the entry in cache

s/is/if/, s/are/have/

> +# The cache entry looks like (node, rev, rawtext)
>  if self._revisioncache:
>  if self._revisioncache[0] == node:
>  # _cache only stores rawtext
>  # rawtext is reusable. but we might need to run flag 
> processors
>  rawtext = self._revisioncache[2]
>  if raw:
> +# if we are don't want to process the raw text and that 
> raw

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


Re: [PATCH 3 of 7] revlog: stop calling `basetext` `rawtext` in _revisiondata

2019-08-21 Thread Yuya Nishihara
On Tue, 20 Aug 2019 18:37:28 +0200, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David 
> # Date 1565214534 -7200
> #  Wed Aug 07 23:48:54 2019 +0200
> # Node ID bab054f6cc691c74c503e043ee82482695b403a4
> # Parent  598ab124d9b67810662db9a5d770e90cf913b9a4
> # EXP-Topic revisiondata
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
> bab054f6cc69
> revlog: stop calling  `basetext` `rawtext` in _revisiondata

>  bins = self._chunks(chain, df=_df, targetsize=targetsize)
> -if rawtext is None:
> -rawtext = bytes(bins[0])
> +if basetext is None:
> +basetext = bytes(bins[0])
>  bins = bins[1:]
>  
> -rawtext = mdiff.patches(rawtext, bins)
> +rawtext = mdiff.patches(basetext, bins)
> +del basetext # let us have a change to free memory early

s/change/chance/ in flight.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel