mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 09:17:30 +03:00
a44fc44f24
Add a --sparse option to `hg diff` which filters the diff to include only files that are part of the sparse profile. When files are moved or copied across the sparse profile boundary, they will show as added or removed (for moves) in the diff. This is the same behaviour as `hg diff --root`. Test Plan: Expand `tests/test-sparse-diff.t` Differential Revision: https://phab.mercurial-scm.org/D797
106 lines
2.6 KiB
Perl
106 lines
2.6 KiB
Perl
$ hg init repo
|
|
$ cd repo
|
|
$ cat > .hg/hgrc <<EOF
|
|
> [extensions]
|
|
> sparse=$TESTDIR/../hgext3rd/sparse.py
|
|
> EOF
|
|
$ mkdir show hide
|
|
$ echo show-modify-1 > show/modify
|
|
$ echo show-remove-1 > show/remove
|
|
$ echo hide-modify-1 > hide/modify
|
|
$ echo hide-remove-1 > hide/remove
|
|
$ echo show-moveout > show/moveout
|
|
$ echo show-movein > hide/movein
|
|
$ hg add show/modify show/remove hide/modify hide/remove show/moveout hide/movein
|
|
$ hg commit -m "first revision"
|
|
$ echo show-modify-2 > show/modify
|
|
$ echo show-add-2 > show/add ; hg add show/add
|
|
$ hg rm show/remove
|
|
$ echo hide-modify-2 > hide/modify
|
|
$ echo hide-add-2 > hide/add ; hg add hide/add
|
|
$ hg rm hide/remove
|
|
$ hg mv hide/movein show/movein
|
|
$ hg mv show/moveout hide/moveout
|
|
$ hg commit -m "second revision"
|
|
$ hg sparse --exclude hide
|
|
|
|
Run diff. This should still show the file contents of excluded files (and should not crash).
|
|
|
|
$ hg diff -r ".^" --git
|
|
diff --git a/hide/add b/hide/add
|
|
new file mode 100644
|
|
--- /dev/null
|
|
+++ b/hide/add
|
|
@@ -0,0 +1,1 @@
|
|
+hide-add-2
|
|
diff --git a/hide/modify b/hide/modify
|
|
--- a/hide/modify
|
|
+++ b/hide/modify
|
|
@@ -1,1 +1,1 @@
|
|
-hide-modify-1
|
|
+hide-modify-2
|
|
diff --git a/show/moveout b/hide/moveout
|
|
rename from show/moveout
|
|
rename to hide/moveout
|
|
diff --git a/hide/remove b/hide/remove
|
|
deleted file mode 100644
|
|
--- a/hide/remove
|
|
+++ /dev/null
|
|
@@ -1,1 +0,0 @@
|
|
-hide-remove-1
|
|
diff --git a/show/add b/show/add
|
|
new file mode 100644
|
|
--- /dev/null
|
|
+++ b/show/add
|
|
@@ -0,0 +1,1 @@
|
|
+show-add-2
|
|
diff --git a/show/modify b/show/modify
|
|
--- a/show/modify
|
|
+++ b/show/modify
|
|
@@ -1,1 +1,1 @@
|
|
-show-modify-1
|
|
+show-modify-2
|
|
diff --git a/hide/movein b/show/movein
|
|
rename from hide/movein
|
|
rename to show/movein
|
|
diff --git a/show/remove b/show/remove
|
|
deleted file mode 100644
|
|
--- a/show/remove
|
|
+++ /dev/null
|
|
@@ -1,1 +0,0 @@
|
|
-show-remove-1
|
|
|
|
Run diff --sparse. This should only show files within the sparse profile.
|
|
|
|
$ hg diff --sparse --git -r ".^"
|
|
diff --git a/show/add b/show/add
|
|
new file mode 100644
|
|
--- /dev/null
|
|
+++ b/show/add
|
|
@@ -0,0 +1,1 @@
|
|
+show-add-2
|
|
diff --git a/show/modify b/show/modify
|
|
--- a/show/modify
|
|
+++ b/show/modify
|
|
@@ -1,1 +1,1 @@
|
|
-show-modify-1
|
|
+show-modify-2
|
|
diff --git a/show/movein b/show/movein
|
|
new file mode 100644
|
|
--- /dev/null
|
|
+++ b/show/movein
|
|
@@ -0,0 +1,1 @@
|
|
+show-movein
|
|
diff --git a/show/moveout b/show/moveout
|
|
deleted file mode 100644
|
|
--- a/show/moveout
|
|
+++ /dev/null
|
|
@@ -1,1 +0,0 @@
|
|
-show-moveout
|
|
diff --git a/show/remove b/show/remove
|
|
deleted file mode 100644
|
|
--- a/show/remove
|
|
+++ /dev/null
|
|
@@ -1,1 +0,0 @@
|
|
-show-remove-1
|