comparison contrib/mercurial.el @ 2457:8e1004c61796

merge emacs changes.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Sun, 18 Jun 2006 21:15:01 -0700
parents aa16b42628b8 74518478d2bf
children 0086056322da
comparison
equal deleted inserted replaced
2456:aa16b42628b8 2457:8e1004c61796
711 (insert (documentation 'hg-help-overview)) 711 (insert (documentation 'hg-help-overview))
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 (end-of-line 1) 715 (end-of-line 1)
716 (delete-region pos (point))))) 716 (delete-region pos (point)))
717 (cd (hg-root))))
717 718
718 (defun hg-add (path) 719 (defun hg-add (path)
719 "Add PATH to the Mercurial repository on the next commit. 720 "Add PATH to the Mercurial repository on the next commit.
720 With a prefix argument, prompt for the path to add." 721 With a prefix argument, prompt for the path to add."
721 (interactive (list (hg-read-file-name " to add"))) 722 (interactive (list (hg-read-file-name " to add")))
722 (let ((buf (current-buffer)) 723 (let ((buf (current-buffer))
723 (update (equal buffer-file-name path))) 724 (update (equal buffer-file-name path)))
724 (hg-view-output (hg-output-buffer-name) 725 (hg-view-output (hg-output-buffer-name)
725 (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)))
726 (when update 731 (when update
727 (with-current-buffer buf 732 (with-current-buffer buf
728 (hg-mode-line))))) 733 (hg-mode-line)))))
729 734
730 (defun hg-addremove () 735 (defun hg-addremove ()
889 '(read-only t)) 894 '(read-only t))
890 (goto-char (point-min)) 895 (goto-char (point-min))
891 (search-forward hg-commit-message-start) 896 (search-forward hg-commit-message-start)
892 (add-text-properties (match-beginning 0) (match-end 0) 897 (add-text-properties (match-beginning 0) (match-end 0)
893 '(read-only t))) 898 '(read-only t)))
894 (hg-commit-mode)))))) 899 (hg-commit-mode)
900 (cd root))))))
895 901
896 (defun hg-diff (path &optional rev1 rev2) 902 (defun hg-diff (path &optional rev1 rev2)
897 "Show the differences between REV1 and REV2 of PATH. 903 "Show the differences between REV1 and REV2 of PATH.
898 When called interactively, the default behaviour is to treat REV1 as 904 When called interactively, the default behaviour is to treat REV1 as
899 the \"parent\" 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
927 (call-process (hg-binary) nil t nil "diff" "-r" one path)) 933 (call-process (hg-binary) nil t nil "diff" "-r" one path))
928 (t 934 (t
929 (call-process (hg-binary) nil t nil "diff" "-r" rev1 "-r" rev2 path))) 935 (call-process (hg-binary) nil t nil "diff" "-r" rev1 "-r" rev2 path)))
930 (diff-mode) 936 (diff-mode)
931 (setq diff (not (= (point-min) (point-max)))) 937 (setq diff (not (= (point-min) (point-max))))
932 (font-lock-fontify-buffer)) 938 (font-lock-fontify-buffer)
939 (cd (hg-root path)))
933 diff)) 940 diff))
934 941
935 (defun hg-diff-repo (path &optional rev1 rev2) 942 (defun hg-diff-repo (path &optional rev1 rev2)
936 "Show the differences between REV1 and REV2 of repository containing PATH. 943 "Show the differences between REV1 and REV2 of repository containing PATH.
937 When called interactively, the default behaviour is to treat REV1 as 944 When called interactively, the default behaviour is to treat REV1 as
952 With a prefix argument, prompt for the path to forget." 959 With a prefix argument, prompt for the path to forget."
953 (interactive (list (hg-read-file-name " to forget"))) 960 (interactive (list (hg-read-file-name " to forget")))
954 (let ((buf (current-buffer)) 961 (let ((buf (current-buffer))
955 (update (equal buffer-file-name path))) 962 (update (equal buffer-file-name path)))
956 (hg-view-output (hg-output-buffer-name) 963 (hg-view-output (hg-output-buffer-name)
957 (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)))
958 (when update 969 (when update
959 (with-current-buffer buf 970 (with-current-buffer buf
960 (hg-mode-line))))) 971 (hg-mode-line)))))
961 972
962 (defun hg-incoming (&optional repo) 973 (defun hg-incoming (&optional repo)
966 (hg-abbrev-file-name (hg-root)) 977 (hg-abbrev-file-name (hg-root))
967 (hg-abbrev-file-name 978 (hg-abbrev-file-name
968 (or repo hg-incoming-repository)))) 979 (or repo hg-incoming-repository))))
969 (call-process (hg-binary) nil t nil "incoming" 980 (call-process (hg-binary) nil t nil "incoming"
970 (or repo hg-incoming-repository)) 981 (or repo hg-incoming-repository))
971 (hg-log-mode))) 982 (hg-log-mode)
983 (cd (hg-root))))
972 984
973 (defun hg-init () 985 (defun hg-init ()
974 (interactive) 986 (interactive)
975 (error "not implemented")) 987 (error "not implemented"))
976 988
1010 "-r" (format "%s:%s" r1 r2) 1022 "-r" (format "%s:%s" r1 r2)
1011 "-l" limit 1023 "-l" limit
1012 (if (> (length path) (length (hg-root path))) 1024 (if (> (length path) (length (hg-root path)))
1013 (cons path nil) 1025 (cons path nil)
1014 nil))) 1026 nil)))
1015 (hg-log-mode)))) 1027 (hg-log-mode)
1028 (cd (hg-root path)))))
1016 1029
1017 (defun hg-log-repo (path &optional rev1 rev2 log-limit) 1030 (defun hg-log-repo (path &optional rev1 rev2 log-limit)
1018 "Display the revision history of the repository containing PATH. 1031 "Display the revision history of the repository containing PATH.
1019 History is displayed between REV1 and REV2. 1032 History is displayed between REV1 and REV2.
1020 Number of displayed changesets is limited to LOG-LIMIT, 1033 Number of displayed changesets is limited to LOG-LIMIT,
1039 (hg-abbrev-file-name (hg-root)) 1052 (hg-abbrev-file-name (hg-root))
1040 (hg-abbrev-file-name 1053 (hg-abbrev-file-name
1041 (or repo hg-outgoing-repository)))) 1054 (or repo hg-outgoing-repository))))
1042 (call-process (hg-binary) nil t nil "outgoing" 1055 (call-process (hg-binary) nil t nil "outgoing"
1043 (or repo hg-outgoing-repository)) 1056 (or repo hg-outgoing-repository))
1044 (hg-log-mode))) 1057 (hg-log-mode)
1058 (cd (hg-root))))
1045 1059
1046 (defun hg-pull (&optional repo) 1060 (defun hg-pull (&optional repo)
1047 "Pull changes from repository REPO. 1061 "Pull changes from repository REPO.
1048 This does not update the working directory." 1062 This does not update the working directory."
1049 (interactive (list (hg-read-repo-name " to pull from"))) 1063 (interactive (list (hg-read-repo-name " to pull from")))
1050 (hg-view-output ((format "Mercurial: Pull to %s from %s" 1064 (hg-view-output ((format "Mercurial: Pull to %s from %s"
1051 (hg-abbrev-file-name (hg-root)) 1065 (hg-abbrev-file-name (hg-root))
1052 (hg-abbrev-file-name 1066 (hg-abbrev-file-name
1053 (or repo hg-incoming-repository)))) 1067 (or repo hg-incoming-repository))))
1054 (call-process (hg-binary) nil t nil "pull" 1068 (call-process (hg-binary) nil t nil "pull"
1055 (or repo hg-incoming-repository)))) 1069 (or repo hg-incoming-repository))
1070 (cd (hg-root))))
1056 1071
1057 (defun hg-push (&optional repo) 1072 (defun hg-push (&optional repo)
1058 "Push changes to repository REPO." 1073 "Push changes to repository REPO."
1059 (interactive (list (hg-read-repo-name " to push to"))) 1074 (interactive (list (hg-read-repo-name " to push to")))
1060 (hg-view-output ((format "Mercurial: Push from %s to %s" 1075 (hg-view-output ((format "Mercurial: Push from %s to %s"
1061 (hg-abbrev-file-name (hg-root)) 1076 (hg-abbrev-file-name (hg-root))
1062 (hg-abbrev-file-name 1077 (hg-abbrev-file-name
1063 (or repo hg-outgoing-repository)))) 1078 (or repo hg-outgoing-repository))))
1064 (call-process (hg-binary) nil t nil "push" 1079 (call-process (hg-binary) nil t nil "push"
1065 (or repo hg-outgoing-repository)))) 1080 (or repo hg-outgoing-repository))
1081 (cd (hg-root))))
1066 1082
1067 (defun hg-revert-buffer-internal () 1083 (defun hg-revert-buffer-internal ()
1068 (let ((ctx (hg-buffer-context))) 1084 (let ((ctx (hg-buffer-context)))
1069 (message "Reverting %s..." buffer-file-name) 1085 (message "Reverting %s..." buffer-file-name)
1070 (hg-run0 "revert" buffer-file-name) 1086 (hg-run0 "revert" buffer-file-name)
1132 (if (> (length name) 0) 1148 (if (> (length name) 0)
1133 name 1149 name
1134 "*")) 1150 "*"))
1135 (hg-abbrev-file-name root))) 1151 (hg-abbrev-file-name root)))
1136 (apply 'call-process (hg-binary) nil t nil 1152 (apply 'call-process (hg-binary) nil t nil
1137 (list "--cwd" root "status" path))))) 1153 (list "--cwd" root "status" path))
1154 (cd (hg-root path)))))
1138 1155
1139 (defun hg-undo () 1156 (defun hg-undo ()
1140 (interactive) 1157 (interactive)
1141 (error "not implemented")) 1158 (error "not implemented"))
1142 1159