commit a95723fbeaee8aa969688609e8c50e8f54cb2281
parent 05a4d724255f331ac99f0708240b8e1bceddee8d
Author: Cosmin Sabou <csabou@mozilla.com>
Date: Tue, 7 Oct 2025 23:03:51 +0300
Revert "Bug 1992685 - Fix path handling in <repo>.diff_stream() (for mach clang-format) r=ahochheiden" for causing vcs failures on test_diff_stream.py
This reverts commit 9204ac856314243af7b7bc2c88b0cf96fbc4e02c.
Diffstat:
2 files changed, 3 insertions(+), 48 deletions(-)
diff --git a/python/mozversioncontrol/mozversioncontrol/repo/jj.py b/python/mozversioncontrol/mozversioncontrol/repo/jj.py
@@ -227,10 +227,10 @@ class JujutsuRepository(Repository):
def diff_stream(self, rev=None, extensions=(), exclude_file=None, context=8):
if rev is None:
rev = self.HEAD_REVSET
- args = ["diff", "-r", rev, "--git"]
+ args = ["diff", "--from", f"roots({rev})-", "--to", f"heads({rev})", "--git"]
# File patterns to include
- patterns = [f'glob:"**/*{dot_extension}"' for dot_extension in extensions]
+ patterns = [f'glob:"*{dot_extension}"' for dot_extension in extensions]
if not patterns:
patterns = ["all()"]
diff --git a/python/mozversioncontrol/test/test_diff_stream.py b/python/mozversioncontrol/test/test_diff_stream.py
@@ -22,17 +22,6 @@ STEPS = {
hg commit -m "FIRST PATCH"
echo bar > file1.txt
""",
- # Create some files for path testing.
- """
- mkdir subdir
- mkdir subdir/another
- echo content > subdir/another/file.c
- echo content > subdir/another/file.json
- echo content > top.cpp
- echo content > top.md
- hg add top.* subdir/another/file.*
- hg commit -m "Set up some files for path testing"
- """,
],
"git": [
"""
@@ -50,17 +39,6 @@ STEPS = {
echo bar > file1.txt
git add file1.txt
""",
- # Create some files for path testing.
- """
- mkdir subdir
- mkdir subdir/another
- echo content > subdir/another/file.c
- echo content > subdir/another/file.json
- echo content > top.cpp
- echo content > top.md
- git add top.* subdir/another/file.*
- git commit -m "Set up some files for path testing"
- """,
],
"jj": [
# Make a base commit.
@@ -80,16 +58,6 @@ STEPS = {
jj new -m "resolve conflict"
echo merged > file1.txt
""",
- # Create some files for path testing.
- """
- mkdir subdir
- mkdir subdir/another
- echo content > subdir/another/file.c
- echo content > subdir/another/file.json
- echo content > top.cpp
- echo content > top.md
- jj commit -m "Set up some files for path testing"
- """,
],
}
@@ -107,7 +75,7 @@ def test_diff_stream(repo):
def changed_files(stream):
files = set()
for line in stream:
- print(line, end="")
+ print(line)
if m := re.match(r"diff --git \w/(\S+)", line):
files.add(m[1])
return files
@@ -139,19 +107,6 @@ def test_diff_stream(repo):
assert "anotherfile.txt" in files
assert "constant.txt" not in files
- # Create some files in a subdir
- repo.execute_next_step()
-
- files = changed_files(
- vcs.diff_stream(
- vcs.head_ref, extensions=(".cpp", ".c", ".cc", ".h", ".m", ".mm")
- )
- )
- assert "top.cpp" in files
- assert "top.md" not in files
- assert "subdir/another/file.c" in files
- assert "subdir/another/file.json" not in files
-
if __name__ == "__main__":
mozunit.main()