Patchwork D6395: rust-dirstate: call new "dirs" rust implementation from Python

login
register
mail settings
Submitter phabricator
Date June 28, 2019, 3:14 p.m.
Message ID <8ffbae06d562e41c31fdcf928805ea3b@localhost.localdomain>
Download mbox | patch
Permalink /patch/40713/
State Not Applicable
Headers show

Comments

phabricator - June 28, 2019, 3:14 p.m.
Closed by commit rHGf5ef8c85477d: rust-dirstate: call new &quot;dirs&quot; rust implementation from Python (authored by Alphare).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6395?vs=15672&id=15696

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

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

AFFECTED FILES
  mercurial/util.py
  rust/hg-core/src/dirstate/dirs_multiset.rs

CHANGE DETAILS




To: Alphare, #hg-reviewers, kevincox
Cc: durin42, kevincox, mercurial-devel
Yuya Nishihara - June 30, 2019, 3:39 a.m.
> --- a/rust/hg-core/src/dirstate/dirs_multiset.rs
> +++ b/rust/hg-core/src/dirstate/dirs_multiset.rs
> @@ -118,7 +118,9 @@
>                      entry.remove();
>                  }
>                  Entry::Vacant(_) => {
> -                    return Err(DirstateMapError::PathNotFound(path.to_owned()))
> +                    return Err(DirstateMapError::PathNotFound(
> +                        path.to_owned(),
> +                    ))
>                  }
>              };

Unrelated change. Dropped.
phabricator - June 30, 2019, 3:41 a.m.
yuja added a comment.


  > - a/rust/hg-core/src/dirstate/dirs_multiset.rs
  >
  > +++ b/rust/hg-core/src/dirstate/dirs_multiset.rs
  > @@ -118,7 +118,9 @@
  >
  >       entry.remove();
  >   }
  >   Entry::Vacant(_) => {
  >
  > - return Err(DirstateMapError::PathNotFound(path.to_owned()))
  >
  > +                    return Err(DirstateMapError::PathNotFound(
  > +                        path.to_owned(),
  > +                    ))
  >
  >       }
  >   };
  
  Unrelated change. Dropped.

REPOSITORY
  rHG Mercurial

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

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

To: Alphare, #hg-reviewers, kevincox
Cc: yuja, durin42, kevincox, mercurial-devel

Patch

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
@@ -118,7 +118,9 @@ 
                     entry.remove();
                 }
                 Entry::Vacant(_) => {
-                    return Err(DirstateMapError::PathNotFound(path.to_owned()))
+                    return Err(DirstateMapError::PathNotFound(
+                        path.to_owned(),
+                    ))
                 }
             };
 
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -53,6 +53,8 @@ 
     stringutil,
 )
 
+rustdirs = policy.importrust('dirstate', 'Dirs')
+
 base85 = policy.importmod(r'base85')
 osutil = policy.importmod(r'osutil')
 parsers = policy.importmod(r'parsers')
@@ -3204,6 +3206,9 @@ 
 if safehasattr(parsers, 'dirs'):
     dirs = parsers.dirs
 
+if rustdirs is not None:
+    dirs = rustdirs
+
 def finddirs(path):
     pos = path.rfind('/')
     while pos != -1: