Show More
@@ -895,37 +895,54 b' Key bindings' | |||
|
895 | 895 | (defun hg-diff (path &optional rev1 rev2) |
|
896 | 896 | "Show the differences between REV1 and REV2 of PATH. |
|
897 | 897 | When called interactively, the default behaviour is to treat REV1 as |
|
898 |
the |
|
|
898 | the \"parent\" revision, REV2 as the current edited version of the file, and | |
|
899 | 899 | PATH as the file edited in the current buffer. |
|
900 | 900 | With a prefix argument, prompt for all of these." |
|
901 | 901 | (interactive (list (hg-read-file-name " to diff") |
|
902 |
|
|
|
902 | (let ((rev1 (hg-read-rev " to start with" 'parent))) | |
|
903 | (and (not (eq rev1 'parent)) rev1)) | |
|
903 | 904 | (let ((rev2 (hg-read-rev " to end with" 'working-dir))) |
|
904 | 905 | (and (not (eq rev2 'working-dir)) rev2)))) |
|
905 | 906 | (hg-sync-buffers path) |
|
906 | 907 | (let ((a-path (hg-abbrev-file-name path)) |
|
907 | (r1 (or rev1 "tip")) | |
|
908 | ;; none revision is specified explicitly | |
|
909 | (none (and (not rev1) (not rev2))) | |
|
910 | ;; only one revision is specified explicitly | |
|
911 | (one (or (and (or (equal rev1 rev2) (not rev2)) rev1) | |
|
912 | (and (not rev1) rev2))) | |
|
908 | 913 | diff) |
|
909 | 914 | (hg-view-output ((cond |
|
910 | ((and (equal r1 "tip") (not rev2)) | |
|
911 |
(format "Mercurial: Diff against t |
|
|
912 | ((equal r1 rev2) | |
|
913 |
(format "Mercurial: Diff of rev %s of %s" |
|
|
915 | (none | |
|
916 | (format "Mercurial: Diff against parent of %s" a-path)) | |
|
917 | (one | |
|
918 | (format "Mercurial: Diff of rev %s of %s" one a-path)) | |
|
914 | 919 | (t |
|
915 | 920 | (format "Mercurial: Diff from rev %s to %s of %s" |
|
916 |
r1 |
|
|
917 | (if rev2 | |
|
918 | (call-process (hg-binary) nil t nil "diff" "-r" r1 "-r" rev2 path) | |
|
919 |
|
|
|
921 | rev1 rev2 a-path)))) | |
|
922 | (cond | |
|
923 | (none | |
|
924 | (call-process (hg-binary) nil t nil "diff" path)) | |
|
925 | (one | |
|
926 | (call-process (hg-binary) nil t nil "diff" "-r" one path)) | |
|
927 | (t | |
|
928 | (call-process (hg-binary) nil t nil "diff" "-r" rev1 "-r" rev2 path))) | |
|
920 | 929 | (diff-mode) |
|
921 | 930 | (setq diff (not (= (point-min) (point-max)))) |
|
922 | 931 | (font-lock-fontify-buffer)) |
|
923 | 932 | diff)) |
|
924 | 933 | |
|
925 | (defun hg-diff-repo () | |
|
926 |
"Show the differences between |
|
|
927 | (interactive) | |
|
928 | (hg-diff (hg-root))) | |
|
934 | (defun hg-diff-repo (path &optional rev1 rev2) | |
|
935 | "Show the differences between REV1 and REV2 of repository containing PATH. | |
|
936 | When called interactively, the default behaviour is to treat REV1 as | |
|
937 | the \"parent\" revision, REV2 as the current edited version of the file, and | |
|
938 | PATH as the `hg-root' of the current buffer. | |
|
939 | With a prefix argument, prompt for all of these." | |
|
940 | (interactive (list (hg-read-file-name " to diff") | |
|
941 | (let ((rev1 (hg-read-rev " to start with" 'parent))) | |
|
942 | (and (not (eq rev1 'parent)) rev1)) | |
|
943 | (let ((rev2 (hg-read-rev " to end with" 'working-dir))) | |
|
944 | (and (not (eq rev2 'working-dir)) rev2)))) | |
|
945 | (hg-diff (hg-root path) rev1 rev2)) | |
|
929 | 946 | |
|
930 | 947 | (defun hg-forget (path) |
|
931 | 948 | "Lose track of PATH, which has been added, but not yet committed. |
General Comments 0
You need to be logged in to leave comments.
Login now