avoid redundant meta data: exclude .hg_archival.txt;
authorwenzelm
Mon, 06 Jun 2022 19:28:02 +0200
changeset 75519 931c48756b88
parent 75518 cb4af8c6152f
child 75520 65ecf4c5b868
avoid redundant meta data: exclude .hg_archival.txt;
src/Pure/General/mercurial.scala
--- a/src/Pure/General/mercurial.scala	Mon Jun 06 19:19:12 2022 +0200
+++ b/src/Pure/General/mercurial.scala	Mon Jun 06 19:28:02 2022 +0200
@@ -329,22 +329,22 @@
             File.Content(Hg_Sync.PATH_DIFF, diff_content) ::
             File.Content(Hg_Sync.PATH_STAT, stat_content) :: contents)
 
-        val (options, source) =
+        val (exclude, source) =
           if (rev.isEmpty) {
-            val exclude_path = tmp_dir + Path.explode("exclude")
-            val exclude = status(options = "--unknown --ignored --no-status")
-            File.write(exclude_path, cat_lines((".hg" :: exclude).map("/" + _)))
-
-            val options = List("--exclude-from=" + exclude_path.implode)
+            val exclude = ".hg" :: status(options = "--unknown --ignored --no-status")
             val source = File.standard_path(root)
-            (options, source)
+            (exclude, source)
           }
           else {
+            val exclude = List(".hg_archival.txt")
             val source = File.standard_path(tmp_dir + Path.explode("archive"))
             archive(source, rev = rev)
-            (Nil, source)
+            (exclude, source)
           }
 
+        val exclude_path = tmp_dir + Path.explode("exclude")
+        File.write(exclude_path, cat_lines(exclude.map("/" + _)))
+
         val protect =
           (Hg_Sync.PATH :: contents.map(_.path))
             .map(path => "protect /" + File.standard_path(path))
@@ -354,7 +354,8 @@
           clean = true,
           prune_empty_dirs = true,
           filter = protect ::: filter,
-          args = options ::: List("--", Isabelle_System.rsync_dir(source), target)
+          args = List("--exclude-from=" + exclude_path.implode, "--",
+            Isabelle_System.rsync_dir(source), target)
         ).check
       }
     }