Skip to content

Commit

Permalink
diff: deprecate xdir diff feature for diff command
Browse files Browse the repository at this point in the history
Summary:
This diff deprecate xdir diff feature for diff command. `subtree diff` is
the recommended command for xdir diff feature.

Reviewed By: muirdm

Differential Revision: D67242555

fbshipit-source-id: 28cd041c2dc29ecf084fcef136a81fb53844f840
  • Loading branch information
zzl0 authored and facebook-github-bot committed Jan 11, 2025
1 parent 855aa56 commit ea5bd9e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions eden/scm/sapling/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2192,6 +2192,11 @@ def diff(ui, repo, *pats, **opts):
Returns 0 on success.
"""
if opts.get("from_path") or opts.get("to_path"):
raise error.Abort(
_("'--from-path' and '--to-path' are deprecated for '@prog@ diff' command"),
hint=_("use '@prog@ subtree diff' to diff between directories"),
)

do_diff(ui, repo, *pats, **opts)

Expand Down
4 changes: 2 additions & 2 deletions eden/scm/sapling/helptext.py
Original file line number Diff line number Diff line change
Expand Up @@ -4683,7 +4683,7 @@
$ echo a > my-project/file
$ echo b > my-branch/file
$ @prog@ diff --from-path my-project --to-path my-branch
$ @prog@ subtree diff --from-path my-project --to-path my-branch
Files outside ``--from-path`` in the left side are ignored, and files
outside ``--to-path`` on the right side are ignored.
Expand All @@ -4706,5 +4706,5 @@
# Modify "file" in both branches and then diff both branches against "my-project":
$ echo branch1 > my-branch1/file
$ echo branch2 > my-branch2/file
$ @prog@ diff --from-path my-project --to-path my-branch1 --from-path my-project --to-path my-branch2
$ @prog@ subtree diff --from-path my-project --to-path my-branch1 --from-path my-project --to-path my-branch2
"""
6 changes: 6 additions & 0 deletions eden/scm/tests/test-diff-xdir.t
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ validate from/to paths:
abort: path 'foofoo' does not exist in commit 112bacaa6bb9
[255]

diff command does not support xdir diff:
$ hg diff -r $A -r $A --from-path foo --to-path bar
abort: '--from-path' and '--to-path' are deprecated for 'hg diff' command
(use 'hg subtree diff' to diff between directories)
[255]

Basic diff with add, modify, and remove:
$ hg subtree diff -r $A -r $A --from-path foo --to-path bar
diff --git a/foo/differs b/bar/differs
Expand Down

0 comments on commit ea5bd9e

Please sign in to comment.