diff --git a/vc-p4.el b/vc-p4.el index ea150bd..3c235e2 100644 --- a/vc-p4.el +++ b/vc-p4.el @@ -74,134 +74,6 @@ ; reeval this buffer to get any new functions that have been added. (put 'P4 'vc-functions nil) -; We need to fix some functions that are broken in vc.el. - -(if (fboundp 'vc-default-resolve-select-yours) t - (defun vc-maybe-resolve-conflicts (file status &optional name-A name-B) - (vc-resynch-buffer file t (not (buffer-modified-p))) - (if (zerop status) (message "Merge successful") - (if (fboundp 'smerge-mode) (smerge-mode 1)) - (if (y-or-n-p "Conflicts detected. Resolve them now? ") - (if (and (fboundp 'smerge-ediff) - (not (fboundp (vc-make-backend-sym (vc-backend file) - 'resolve-select-yours)))) - (smerge-ediff) - (vc-resolve-conflicts name-A name-B)) - (message "File contains conflict markers")))) - - (defun vc-default-resolve-select-yours (backend) - (goto-char (point-min)) - (let ((found nil)) - (while (re-search-forward (concat "^<<<<<<< " - (regexp-quote file-name) "\n") nil t) - (setq found t) - (replace-match "") - (if (not (re-search-forward "^=======\n" nil t)) - (error "Malformed conflict marker")) - (replace-match "") - (let ((start (point))) - (if (not (re-search-forward "^>>>>>>> [0-9.]+\n" nil t)) - (error "Malformed conflict marker")) - (delete-region start (point)))) - found)) - - (defun vc-default-resolve-select-theirs (backend) - (goto-char (point-min)) - (while (re-search-forward (concat "^<<<<<<< " - (regexp-quote file-name) "\n") nil t) - (let ((start (match-beginning 0))) - (if (not (re-search-forward "^=======\n" nil t)) - (error "Malformed conflict marker")) - (delete-region start (point)) - (if (not (re-search-forward "^>>>>>>> [0-9.]+\n" nil t)) - (error "Malformed conflict marker")) - (replace-match ""))) - t) - - (defun vc-default-resolve-select-original (backend) - nil) - - (defun vc-resolve-conflicts (&optional name-A name-B) - "Invoke ediff to resolve conflicts in the current buffer. -The conflicts must be marked with rcsmerge conflict markers." - (interactive) - (vc-ensure-vc-buffer) - (let* ((found nil) - (file-name (file-name-nondirectory buffer-file-name)) - (backend (vc-backend buffer-file-name)) - (your-buffer (generate-new-buffer - (concat "*" file-name - " " (or name-A "WORKFILE") "*"))) - (other-buffer (generate-new-buffer - (concat "*" file-name - " " (or name-B "CHECKED-IN") "*"))) - (ancestor-buffer (generate-new-buffer - (concat "*" file-name - " " (or name-B "ORIGINAL") "*"))) - (result-buffer (current-buffer))) - (save-excursion - (set-buffer your-buffer) - (erase-buffer) - (insert-buffer-substring result-buffer) - (if (not (vc-call-backend backend 'resolve-select-yours)) - (progn - (kill-buffer your-buffer) - (kill-buffer other-buffer) - (kill-buffer ancestor-buffer) - (error "No conflict markers found"))) - - (set-buffer other-buffer) - (erase-buffer) - (insert-buffer-substring result-buffer) - (vc-call-backend backend 'resolve-select-theirs) - - (set-buffer ancestor-buffer) - (erase-buffer) - (insert-buffer-substring result-buffer) - (goto-char (point-min)) - (if (not (vc-call-backend backend 'resolve-select-original)) - (progn - (kill-buffer ancestor-buffer) - (setq ancestor-buffer nil))) - - (let ((config (current-window-configuration)) - (ediff-default-variant 'default-B)) - - ;; Fire up ediff. - - (set-buffer - (if ancestor-buffer - (ediff-merge-buffers-with-ancestor your-buffer other-buffer - ancestor-buffer) - (ediff-merge-buffers your-buffer other-buffer))) - - ;; Ediff is now set up, and we are in the control buffer. - ;; Do a few further adjustments and take precautions for exit. - - (make-local-variable 'vc-ediff-windows) - (setq vc-ediff-windows config) - (make-local-variable 'vc-ediff-result) - (setq vc-ediff-result result-buffer) - (make-local-variable 'ediff-quit-hook) - (setq ediff-quit-hook - (lambda () - (let ((buffer-A ediff-buffer-A) - (buffer-B ediff-buffer-B) - (buffer-C ediff-buffer-C) - (result vc-ediff-result) - (windows vc-ediff-windows)) - (ediff-cleanup-mess) - (set-buffer result) - (erase-buffer) - (insert-buffer-substring buffer-C) - (kill-buffer buffer-A) - (kill-buffer buffer-B) - (kill-buffer buffer-C) - (set-window-configuration windows) - (message "Conflict resolution finished; you may save the buffer")))) - (message "Please resolve conflicts now; exit ediff when done") - nil))))) - (defcustom vc-p4-require-p4config nil "*If non-nil and the `P4CONFIG' environment variable is set, then only perform p4 operations on a file when a P4CONFIG file can be found