changeset 48315:a44bb185f6bd stable 6.0rc0

merge with default
author Pulkit Goyal <7895pulkit@gmail.com>
date Tue, 09 Nov 2021 21:56:04 +0530
parents 6f43569729d4 (diff) 6d69e83e6b6e (current diff)
children e2be55b3d040
files mercurial/scmutil.py
diffstat 6 files changed, 30 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/relnotes/5.9	Tue Oct 26 19:47:30 2021 +0100
+++ b/relnotes/5.9	Tue Nov 09 21:56:04 2021 +0530
@@ -2,7 +2,7 @@
 
  * `hg config` now has a `--source` option to show where each
    configuration value comes from.
- * Introduced a command (debug-repair-issue6533) to repair repositories affected
+ * Introduced a command (debug-repair-issue6528) to repair repositories affected
    by issue6528 where certain files would show up as modified even if they were
    clean due to an issue in the copy-tracing code.
 
--- a/rust/hg-core/src/utils/path_auditor.rs	Tue Oct 26 19:47:30 2021 +0100
+++ b/rust/hg-core/src/utils/path_auditor.rs	Tue Nov 09 21:56:04 2021 +0530
@@ -180,12 +180,14 @@
 #[cfg(test)]
 mod tests {
     use super::*;
-    use crate::utils::files::get_path_from_bytes;
-    use crate::utils::hg_path::path_to_hg_path_buf;
+    use std::fs::{create_dir, File};
+    use tempfile::tempdir;
 
     #[test]
     fn test_path_auditor() {
-        let auditor = PathAuditor::new(get_path_from_bytes(b"/tmp"));
+        let base_dir = tempdir().unwrap();
+        let base_dir_path = base_dir.path();
+        let auditor = PathAuditor::new(base_dir_path);
 
         let path = HgPath::new(b".hg/00changelog.i");
         assert_eq!(
@@ -201,32 +203,20 @@
             })
         );
 
-        use std::fs::{create_dir, File};
-        use tempfile::tempdir;
-
-        let base_dir = tempdir().unwrap();
-        let base_dir_path = base_dir.path();
-        let skip = base_dir_path.components().count() - 1;
-        let a = base_dir_path.join("a");
-        let b = base_dir_path.join("b");
-        create_dir(&a).unwrap();
-        let in_a_path = a.join("in_a");
-        File::create(in_a_path).unwrap();
-
+        create_dir(&base_dir_path.join("realdir")).unwrap();
+        File::create(&base_dir_path.join("realdir/realfile")).unwrap();
         // TODO make portable
-        std::os::unix::fs::symlink(&a, &b).unwrap();
-
-        let buf = b.join("in_a").components().skip(skip).collect::<PathBuf>();
-        eprintln!("buf: {}", buf.display());
-        let path = path_to_hg_path_buf(buf).unwrap();
+        std::os::unix::fs::symlink(
+            &base_dir_path.join("realdir"),
+            &base_dir_path.join("symlink"),
+        )
+        .unwrap();
+        let path = HgPath::new(b"symlink/realfile");
         assert_eq!(
-            auditor.audit_path(&path),
+            auditor.audit_path(path),
             Err(HgPathError::TraversesSymbolicLink {
-                path: path,
-                symlink: path_to_hg_path_buf(
-                    b.components().skip(2).collect::<PathBuf>()
-                )
-                .unwrap()
+                path: path.to_owned(),
+                symlink: HgPathBuf::from_bytes(b"symlink"),
             })
         );
     }
--- a/tests/hghave.py	Tue Oct 26 19:47:30 2021 +0100
+++ b/tests/hghave.py	Tue Nov 09 21:56:04 2021 +0530
@@ -264,6 +264,13 @@
     return not (new_file_has_exec or exec_flags_cannot_flip)
 
 
+@check("suidbit", "setuid and setgid bit")
+def has_suidbit():
+    if getattr(os, "statvfs", None) is None or getattr(os, "ST_NOSUID") is None:
+        return False
+    return bool(os.statvfs('.').f_flag & os.ST_NOSUID)
+
+
 @check("icasefs", "case insensitive file system")
 def has_icasefs():
     # Stolen from mercurial.util
--- a/tests/test-remotefilelog-permissions.t	Tue Oct 26 19:47:30 2021 +0100
+++ b/tests/test-remotefilelog-permissions.t	Tue Nov 09 21:56:04 2021 +0530
@@ -33,6 +33,8 @@
 
   $ chmod -R u+w master/.hg/remotefilelogcache
 
+#if suidbit
+
 # Test setting up shared cache with the right permissions
 # (this is hard to test in a cross platform way, so we just make sure nothing
 # crashes)
@@ -44,3 +46,5 @@
   1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob)
   $ ls -ld $CACHEDIR/11
   drwxrws* $TESTTMP/hgcache/11 (glob)
+
+#endif
--- a/tests/test-run-tests.t	Tue Oct 26 19:47:30 2021 +0100
+++ b/tests/test-run-tests.t	Tue Nov 09 21:56:04 2021 +0530
@@ -23,7 +23,7 @@
 #if symlink
   $ ln -s `which true` hg
   $ "$PYTHON" $TESTDIR/run-tests.py --with-hg=./hg
-  warning: --with-hg should specify an hg script, not: true
+  ^warning: --with-hg should specify an hg script, not: (true|coreutils)$ (re)
   running 0 tests using 0 parallel processes 
   
   # Ran 0 tests, 0 skipped, 0 failed.
--- a/tests/test-serve.t	Tue Oct 26 19:47:30 2021 +0100
+++ b/tests/test-serve.t	Tue Nov 09 21:56:04 2021 +0530
@@ -57,6 +57,7 @@
   $ hgserve -p daytime
   abort: cannot start server at 'localhost:13': Permission denied (?)
   abort: child process failed to start (?)
+  abort: no port number associated with service 'daytime' (?)
   listening at http://localhost/ (bound to $LOCALIP:13) (?)
   % errors
   $ KILLQUIETLY=N