##// END OF EJS Templates
merge with crew
Benoit Boissinot -
r2459:5c5277f0 merge default
parent child Browse files
Show More
@@ -380,7 +380,7 b" Handle frickin' frackin' gratuitous even"
380 (save-excursion
380 (save-excursion
381 (while hg-prev-buffer
381 (while hg-prev-buffer
382 (set-buffer hg-prev-buffer))
382 (set-buffer hg-prev-buffer))
383 (let ((path (or default (buffer-file-name))))
383 (let ((path (or default (buffer-file-name) default-directory)))
384 (if (or (not path) current-prefix-arg)
384 (if (or (not path) current-prefix-arg)
385 (expand-file-name
385 (expand-file-name
386 (eval (list* 'read-file-name
386 (eval (list* 'read-file-name
@@ -712,7 +712,9 b' code by typing `M-x find-library mercuri'
712 (let ((pos (point)))
712 (let ((pos (point)))
713 (insert (documentation 'hg-mode))
713 (insert (documentation 'hg-mode))
714 (goto-char pos)
714 (goto-char pos)
715 (kill-line))))
715 (end-of-line 1)
716 (delete-region pos (point)))
717 (cd (hg-root))))
716
718
717 (defun hg-add (path)
719 (defun hg-add (path)
718 "Add PATH to the Mercurial repository on the next commit.
720 "Add PATH to the Mercurial repository on the next commit.
@@ -721,7 +723,11 b' With a prefix argument, prompt for the p'
721 (let ((buf (current-buffer))
723 (let ((buf (current-buffer))
722 (update (equal buffer-file-name path)))
724 (update (equal buffer-file-name path)))
723 (hg-view-output (hg-output-buffer-name)
725 (hg-view-output (hg-output-buffer-name)
724 (apply 'call-process (hg-binary) nil t nil (list "add" path)))
726 (apply 'call-process (hg-binary) nil t nil (list "add" path))
727 ;; "hg add" shows pathes relative NOT TO ROOT BUT TO REPOSITORY
728 (replace-regexp " \\.\\.." " " nil 0 (buffer-size))
729 (goto-char 0)
730 (cd (hg-root path)))
725 (when update
731 (when update
726 (with-current-buffer buf
732 (with-current-buffer buf
727 (hg-mode-line)))))
733 (hg-mode-line)))))
@@ -890,42 +896,61 b' Key bindings'
890 (search-forward hg-commit-message-start)
896 (search-forward hg-commit-message-start)
891 (add-text-properties (match-beginning 0) (match-end 0)
897 (add-text-properties (match-beginning 0) (match-end 0)
892 '(read-only t)))
898 '(read-only t)))
893 (hg-commit-mode))))))
899 (hg-commit-mode)
900 (cd root))))))
894
901
895 (defun hg-diff (path &optional rev1 rev2)
902 (defun hg-diff (path &optional rev1 rev2)
896 "Show the differences between REV1 and REV2 of PATH.
903 "Show the differences between REV1 and REV2 of PATH.
897 When called interactively, the default behaviour is to treat REV1 as
904 When called interactively, the default behaviour is to treat REV1 as
898 the tip revision, REV2 as the current edited version of the file, and
905 the \"parent\" revision, REV2 as the current edited version of the file, and
899 PATH as the file edited in the current buffer.
906 PATH as the file edited in the current buffer.
900 With a prefix argument, prompt for all of these."
907 With a prefix argument, prompt for all of these."
901 (interactive (list (hg-read-file-name " to diff")
908 (interactive (list (hg-read-file-name " to diff")
902 (hg-read-rev " to start with")
909 (let ((rev1 (hg-read-rev " to start with" 'parent)))
910 (and (not (eq rev1 'parent)) rev1))
903 (let ((rev2 (hg-read-rev " to end with" 'working-dir)))
911 (let ((rev2 (hg-read-rev " to end with" 'working-dir)))
904 (and (not (eq rev2 'working-dir)) rev2))))
912 (and (not (eq rev2 'working-dir)) rev2))))
905 (hg-sync-buffers path)
913 (hg-sync-buffers path)
906 (let ((a-path (hg-abbrev-file-name path))
914 (let ((a-path (hg-abbrev-file-name path))
907 (r1 (or rev1 "tip"))
915 ;; none revision is specified explicitly
916 (none (and (not rev1) (not rev2)))
917 ;; only one revision is specified explicitly
918 (one (or (and (or (equal rev1 rev2) (not rev2)) rev1)
919 (and (not rev1) rev2)))
908 diff)
920 diff)
909 (hg-view-output ((cond
921 (hg-view-output ((cond
910 ((and (equal r1 "tip") (not rev2))
922 (none
911 (format "Mercurial: Diff against tip of %s" a-path))
923 (format "Mercurial: Diff against parent of %s" a-path))
912 ((equal r1 rev2)
924 (one
913 (format "Mercurial: Diff of rev %s of %s" r1 a-path))
925 (format "Mercurial: Diff of rev %s of %s" one a-path))
914 (t
926 (t
915 (format "Mercurial: Diff from rev %s to %s of %s"
927 (format "Mercurial: Diff from rev %s to %s of %s"
916 r1 (or rev2 "Current") a-path))))
928 rev1 rev2 a-path))))
917 (if rev2
929 (cond
918 (call-process (hg-binary) nil t nil "diff" "-r" r1 "-r" rev2 path)
930 (none
919 (call-process (hg-binary) nil t nil "diff" "-r" r1 path))
931 (call-process (hg-binary) nil t nil "diff" path))
932 (one
933 (call-process (hg-binary) nil t nil "diff" "-r" one path))
934 (t
935 (call-process (hg-binary) nil t nil "diff" "-r" rev1 "-r" rev2 path)))
920 (diff-mode)
936 (diff-mode)
921 (setq diff (not (= (point-min) (point-max))))
937 (setq diff (not (= (point-min) (point-max))))
922 (font-lock-fontify-buffer))
938 (font-lock-fontify-buffer)
939 (cd (hg-root path)))
923 diff))
940 diff))
924
941
925 (defun hg-diff-repo ()
942 (defun hg-diff-repo (path &optional rev1 rev2)
926 "Show the differences between the working copy and the tip revision."
943 "Show the differences between REV1 and REV2 of repository containing PATH.
927 (interactive)
944 When called interactively, the default behaviour is to treat REV1 as
928 (hg-diff (hg-root)))
945 the \"parent\" revision, REV2 as the current edited version of the file, and
946 PATH as the `hg-root' of the current buffer.
947 With a prefix argument, prompt for all of these."
948 (interactive (list (hg-read-file-name " to diff")
949 (let ((rev1 (hg-read-rev " to start with" 'parent)))
950 (and (not (eq rev1 'parent)) rev1))
951 (let ((rev2 (hg-read-rev " to end with" 'working-dir)))
952 (and (not (eq rev2 'working-dir)) rev2))))
953 (hg-diff (hg-root path) rev1 rev2))
929
954
930 (defun hg-forget (path)
955 (defun hg-forget (path)
931 "Lose track of PATH, which has been added, but not yet committed.
956 "Lose track of PATH, which has been added, but not yet committed.
@@ -936,7 +961,11 b' With a prefix argument, prompt for the p'
936 (let ((buf (current-buffer))
961 (let ((buf (current-buffer))
937 (update (equal buffer-file-name path)))
962 (update (equal buffer-file-name path)))
938 (hg-view-output (hg-output-buffer-name)
963 (hg-view-output (hg-output-buffer-name)
939 (apply 'call-process (hg-binary) nil t nil (list "forget" path)))
964 (apply 'call-process (hg-binary) nil t nil (list "forget" path))
965 ;; "hg forget" shows pathes relative NOT TO ROOT BUT TO REPOSITORY
966 (replace-regexp " \\.\\.." " " nil 0 (buffer-size))
967 (goto-char 0)
968 (cd (hg-root path)))
940 (when update
969 (when update
941 (with-current-buffer buf
970 (with-current-buffer buf
942 (hg-mode-line)))))
971 (hg-mode-line)))))
@@ -950,7 +979,8 b' With a prefix argument, prompt for the p'
950 (or repo hg-incoming-repository))))
979 (or repo hg-incoming-repository))))
951 (call-process (hg-binary) nil t nil "incoming"
980 (call-process (hg-binary) nil t nil "incoming"
952 (or repo hg-incoming-repository))
981 (or repo hg-incoming-repository))
953 (hg-log-mode)))
982 (hg-log-mode)
983 (cd (hg-root))))
954
984
955 (defun hg-init ()
985 (defun hg-init ()
956 (interactive)
986 (interactive)
@@ -959,8 +989,8 b' With a prefix argument, prompt for the p'
959 (defun hg-log-mode ()
989 (defun hg-log-mode ()
960 "Mode for viewing a Mercurial change log."
990 "Mode for viewing a Mercurial change log."
961 (goto-char (point-min))
991 (goto-char (point-min))
962 (when (looking-at "^searching for changes")
992 (when (looking-at "^searching for changes.*$")
963 (kill-entire-line))
993 (delete-region (match-beginning 0) (match-end 0)))
964 (run-hooks 'hg-log-mode-hook))
994 (run-hooks 'hg-log-mode-hook))
965
995
966 (defun hg-log (path &optional rev1 rev2 log-limit)
996 (defun hg-log (path &optional rev1 rev2 log-limit)
@@ -994,7 +1024,8 b' With a prefix argument, prompt for each '
994 (if (> (length path) (length (hg-root path)))
1024 (if (> (length path) (length (hg-root path)))
995 (cons path nil)
1025 (cons path nil)
996 nil)))
1026 nil)))
997 (hg-log-mode))))
1027 (hg-log-mode)
1028 (cd (hg-root path)))))
998
1029
999 (defun hg-log-repo (path &optional rev1 rev2 log-limit)
1030 (defun hg-log-repo (path &optional rev1 rev2 log-limit)
1000 "Display the revision history of the repository containing PATH.
1031 "Display the revision history of the repository containing PATH.
@@ -1023,7 +1054,8 b' With a prefix argument, prompt for each '
1023 (or repo hg-outgoing-repository))))
1054 (or repo hg-outgoing-repository))))
1024 (call-process (hg-binary) nil t nil "outgoing"
1055 (call-process (hg-binary) nil t nil "outgoing"
1025 (or repo hg-outgoing-repository))
1056 (or repo hg-outgoing-repository))
1026 (hg-log-mode)))
1057 (hg-log-mode)
1058 (cd (hg-root))))
1027
1059
1028 (defun hg-pull (&optional repo)
1060 (defun hg-pull (&optional repo)
1029 "Pull changes from repository REPO.
1061 "Pull changes from repository REPO.
@@ -1034,7 +1066,8 b' This does not update the working directo'
1034 (hg-abbrev-file-name
1066 (hg-abbrev-file-name
1035 (or repo hg-incoming-repository))))
1067 (or repo hg-incoming-repository))))
1036 (call-process (hg-binary) nil t nil "pull"
1068 (call-process (hg-binary) nil t nil "pull"
1037 (or repo hg-incoming-repository))))
1069 (or repo hg-incoming-repository))
1070 (cd (hg-root))))
1038
1071
1039 (defun hg-push (&optional repo)
1072 (defun hg-push (&optional repo)
1040 "Push changes to repository REPO."
1073 "Push changes to repository REPO."
@@ -1044,7 +1077,8 b' This does not update the working directo'
1044 (hg-abbrev-file-name
1077 (hg-abbrev-file-name
1045 (or repo hg-outgoing-repository))))
1078 (or repo hg-outgoing-repository))))
1046 (call-process (hg-binary) nil t nil "push"
1079 (call-process (hg-binary) nil t nil "push"
1047 (or repo hg-outgoing-repository))))
1080 (or repo hg-outgoing-repository))
1081 (cd (hg-root))))
1048
1082
1049 (defun hg-revert-buffer-internal ()
1083 (defun hg-revert-buffer-internal ()
1050 (let ((ctx (hg-buffer-context)))
1084 (let ((ctx (hg-buffer-context)))
@@ -1085,7 +1119,11 b' prompts for a path to check."'
1085 (interactive (list (hg-read-file-name)))
1119 (interactive (list (hg-read-file-name)))
1086 (if (or path (not hg-root))
1120 (if (or path (not hg-root))
1087 (let ((root (do ((prev nil dir)
1121 (let ((root (do ((prev nil dir)
1088 (dir (file-name-directory (or path buffer-file-name ""))
1122 (dir (file-name-directory
1123 (or
1124 path
1125 buffer-file-name
1126 (expand-file-name default-directory)))
1089 (file-name-directory (directory-file-name dir))))
1127 (file-name-directory (directory-file-name dir))))
1090 ((equal prev dir))
1128 ((equal prev dir))
1091 (when (file-directory-p (concat dir ".hg"))
1129 (when (file-directory-p (concat dir ".hg"))
@@ -1112,7 +1150,8 b' Names are displayed relative to the repo'
1112 "*"))
1150 "*"))
1113 (hg-abbrev-file-name root)))
1151 (hg-abbrev-file-name root)))
1114 (apply 'call-process (hg-binary) nil t nil
1152 (apply 'call-process (hg-binary) nil t nil
1115 (list "--cwd" root "status" path)))))
1153 (list "--cwd" root "status" path))
1154 (cd (hg-root path)))))
1116
1155
1117 (defun hg-undo ()
1156 (defun hg-undo ()
1118 (interactive)
1157 (interactive)
General Comments 0
You need to be logged in to leave comments. Login now