comparison lisp/pcvs.el @ 34653:433f1bff06f5

(cvs-diff-backup-extractor): Return full-path for file. (cvs-execute-single-file): Don't change directory. Patch from Per Cederqvist.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 18 Dec 2000 03:17:40 +0000
parents da1ec51d3da7
children d88382df7b52
comparison
equal deleted inserted replaced
34652:45a589a4c480 34653:433f1bff06f5
1 ;;; pcvs.el -- A Front-end to CVS. 1 ;;; pcvs.el -- A Front-end to CVS.
2 2
3 ;; Copyright (C) 1991, 92, 93, 94, 95, 95, 97, 98, 99, 2000 Free Software Foundation, Inc. 3 ;; Copyright (C) 1991,92,93,94,95,95,97,98,99,2000 Free Software Foundation, Inc.
4 4
5 ;; Author: (The PCL-CVS Trust) pcl-cvs@cyclic.com 5 ;; Author: (The PCL-CVS Trust) pcl-cvs@cyclic.com
6 ;; (Per Cederqvist) ceder@lysator.liu.se 6 ;; (Per Cederqvist) ceder@lysator.liu.se
7 ;; (Greg A. Woods) woods@weird.com 7 ;; (Greg A. Woods) woods@weird.com
8 ;; (Jim Blandy) jimb@cyclic.com 8 ;; (Jim Blandy) jimb@cyclic.com
11 ;; (Stefan Monnier) monnier@cs.yale.edu 11 ;; (Stefan Monnier) monnier@cs.yale.edu
12 ;; (Greg Klanderman) greg@alphatech.com 12 ;; (Greg Klanderman) greg@alphatech.com
13 ;; (Jari Aalto+mail.emacs) jari.aalto@poboxes.com 13 ;; (Jari Aalto+mail.emacs) jari.aalto@poboxes.com
14 ;; Maintainer: (Stefan Monnier) monnier+lists/cvs/pcl@flint.cs.yale.edu 14 ;; Maintainer: (Stefan Monnier) monnier+lists/cvs/pcl@flint.cs.yale.edu
15 ;; Keywords: CVS, version control, release management 15 ;; Keywords: CVS, version control, release management
16 ;; Version: $Name: $ 16 ;; Revision: $Id: pcvs.el,v 1.22 2000/12/11 03:20:21 monnier Exp $
17 ;; Revision: $Id: pcvs.el,v 1.21 2000/12/10 21:20:56 monnier Exp $
18 17
19 ;; This file is part of GNU Emacs. 18 ;; This file is part of GNU Emacs.
20 19
21 ;; GNU Emacs is free software; you can redistribute it and/or modify 20 ;; GNU Emacs is free software; you can redistribute it and/or modify
22 ;; it under the terms of the GNU General Public License as published by 21 ;; it under the terms of the GNU General Public License as published by
1426 "Return the filename and the name of the backup file as a list. 1425 "Return the filename and the name of the backup file as a list.
1427 Signal an error if there is no backup file." 1426 Signal an error if there is no backup file."
1428 (let ((backup-file (cvs-fileinfo->backup-file fileinfo))) 1427 (let ((backup-file (cvs-fileinfo->backup-file fileinfo)))
1429 (unless backup-file 1428 (unless backup-file
1430 (error "%s has no backup file." (cvs-fileinfo->full-path fileinfo))) 1429 (error "%s has no backup file." (cvs-fileinfo->full-path fileinfo)))
1431 (list backup-file (cvs-fileinfo->file fileinfo)))) 1430 (list backup-file (cvs-fileinfo->full-path fileinfo))))
1432 1431
1433 ;; 1432 ;;
1434 ;; Emerge support 1433 ;; Emerge support
1435 ;; 1434 ;;
1436 (defun cvs-emerge-diff (b1 b2) (emerge-buffers b1 b2 b1)) 1435 (defun cvs-emerge-diff (b1 b2) (emerge-buffers b1 b2 b1))
1946 (and (not (eq (cvs-fileinfo->type fileinfo) 'DIRCHANGE)) 1945 (and (not (eq (cvs-fileinfo->type fileinfo) 'DIRCHANGE))
1947 (cvs-string-prefix-p dir (cvs-fileinfo->dir fileinfo)))) 1946 (cvs-string-prefix-p dir (cvs-fileinfo->dir fileinfo))))
1948 1947
1949 (defun cvs-execute-single-file (fi extractor program constant-args) 1948 (defun cvs-execute-single-file (fi extractor program constant-args)
1950 "Internal function for `cvs-execute-single-file-list'." 1949 "Internal function for `cvs-execute-single-file-list'."
1951 (let* ((cur-dir (cvs-fileinfo->dir fi)) 1950 (let* ((arg-list (funcall extractor fi))
1952 (default-directory (cvs-expand-dir-name cur-dir)) 1951 (inhibit-read-only t))
1953 (inhibit-read-only t)
1954 (arg-list (funcall extractor fi)))
1955 1952
1956 ;; Execute the command unless extractor returned t. 1953 ;; Execute the command unless extractor returned t.
1957 (when (listp arg-list) 1954 (when (listp arg-list)
1958 (let* ((args (append constant-args arg-list))) 1955 (let* ((args (append constant-args arg-list)))
1959 1956
1960 (insert (format "=== cd %s\n=== %s %s\n\n" 1957 (insert (format "=== %s %s\n\n"
1961 cur-dir program (cvs-strings->string args))) 1958 program (cvs-strings->string args)))
1962 1959
1963 ;; FIXME: return the exit status? 1960 ;; FIXME: return the exit status?
1964 (apply 'call-process program nil t t args) 1961 (apply 'call-process program nil t t args)
1965 (goto-char (point-max)))))) 1962 (goto-char (point-max))))))
1966 1963
1967 ;; FIXME: make this run in the background ala cvs-run-process... 1964 ;; FIXME: make this run in the background ala cvs-run-process...
1968 (defun cvs-execute-single-file-list (fis extractor program constant-args) 1965 (defun cvs-execute-single-file-list (fis extractor program constant-args)
1969 "Run PROGRAM on all elements on FIS. 1966 "Run PROGRAM on all elements on FIS.
1970 The PROGRAM will be called with pwd set to the directory the files 1967 CONSTANT-ARGS is a list of strings to pass as arguments to PROGRAM.
1971 reside in. CONSTANT-ARGS is a list of strings to pass as arguments to 1968 The arguments given to the program will be CONSTANT-ARGS followed by
1972 PROGRAM. The arguments given to the program will be CONSTANT-ARGS 1969 the list that EXTRACTOR returns.
1973 followed by the list that EXTRACTOR returns.
1974 1970
1975 EXTRACTOR will be called once for each file on FIS. It is given 1971 EXTRACTOR will be called once for each file on FIS. It is given
1976 one argument, the cvs-fileinfo. It can return t, which means ignore 1972 one argument, the cvs-fileinfo. It can return t, which means ignore
1977 this file, or a list of arguments to send to the program." 1973 this file, or a list of arguments to send to the program."
1978 (dolist (fi fis) 1974 (dolist (fi fis)