Mercurial > emacs
comparison lisp/vc.el @ 25790:7a57f8890220
(vc-backend-checkout): Use with-temp-file to check out into arbitrary
file names.
author | André Spiegel <spiegel@gnu.org> |
---|---|
date | Wed, 22 Sep 1999 12:58:49 +0000 |
parents | 913fac3ab440 |
children | d24b874488ef |
comparison
equal
deleted
inserted
replaced
25789:d68642dd5bbf | 25790:7a57f8890220 |
---|---|
3 ;; Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com> | 5 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com> |
6 ;; Maintainer: Andre Spiegel <spiegel@inf.fu-berlin.de> | 6 ;; Maintainer: Andre Spiegel <spiegel@inf.fu-berlin.de> |
7 | 7 |
8 ;; $Id: vc.el,v 1.253 1999/09/06 03:46:33 rms Exp rms $ | 8 ;; $Id: vc.el,v 1.254 1999/09/06 22:15:10 rms Exp $ |
9 | 9 |
10 ;; This file is part of GNU Emacs. | 10 ;; This file is part of GNU Emacs. |
11 | 11 |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | 12 ;; GNU Emacs is free software; you can redistribute it and/or modify |
13 ;; it under the terms of the GNU General Public License as published by | 13 ;; it under the terms of the GNU General Public License as published by |
2593 (let ((vc-modes (logior (file-modes (vc-name file)) | 2593 (let ((vc-modes (logior (file-modes (vc-name file)) |
2594 (if writable 128 0))) | 2594 (if writable 128 0))) |
2595 (failed t)) | 2595 (failed t)) |
2596 (unwind-protect | 2596 (unwind-protect |
2597 (progn | 2597 (progn |
2598 (apply 'vc-do-command | 2598 (with-temp-file filename |
2599 nil 0 "/bin/sh" file 'MASTER "-c" | 2599 (apply 'vc-do-command |
2600 ;; Some shells make the "" dummy argument into $0 | 2600 (current-buffer) 0 "get" file 'MASTER |
2601 ;; while others use the shell's name as $0 and | 2601 "-s" ;; suppress diagnostic output |
2602 ;; use the "" as $1. The if-statement | 2602 (if writable "-e") |
2603 ;; converts the latter case to the former. | 2603 "-p" |
2604 (format "if [ x\"$1\" = x ]; then shift; fi; \ | 2604 (and rev |
2605 umask %o; exec >\"$1\" || exit; \ | 2605 (concat "-r" |
2606 shift; umask %o; exec get \"$@\"" | 2606 (vc-lookup-triple file rev))) |
2607 (logand 511 (lognot vc-modes)) | 2607 switches)) |
2608 (logand 511 (lognot (default-file-modes)))) | 2608 (set-file-modes filename |
2609 "" ; dummy argument for shell's $0 | 2609 (logior (file-modes (vc-name file)) |
2610 filename | 2610 (if writable 128 0))) |
2611 (if writable "-e") | 2611 (setq failed nil)) |
2612 "-p" | |
2613 (and rev | |
2614 (concat "-r" (vc-lookup-triple file rev))) | |
2615 switches) | |
2616 (setq failed nil)) | |
2617 (and failed (file-exists-p filename) | 2612 (and failed (file-exists-p filename) |
2618 (delete-file filename)))) | 2613 (delete-file filename)))) |
2619 (apply 'vc-do-command nil 0 "get" file 'MASTER ;; SCCS | 2614 (apply 'vc-do-command nil 0 "get" file 'MASTER ;; SCCS |
2620 (if writable "-e") | 2615 (if writable "-e") |
2621 (and rev (concat "-r" (vc-lookup-triple file rev))) | 2616 (and rev (concat "-r" (vc-lookup-triple file rev))) |
2627 (let ((vc-modes (logior (file-modes (vc-name file)) | 2622 (let ((vc-modes (logior (file-modes (vc-name file)) |
2628 (if writable 128 0))) | 2623 (if writable 128 0))) |
2629 (failed t)) | 2624 (failed t)) |
2630 (unwind-protect | 2625 (unwind-protect |
2631 (progn | 2626 (progn |
2632 (apply 'vc-do-command | 2627 (with-temp-file filename |
2633 nil 0 "/bin/sh" file 'MASTER "-c" | 2628 (apply 'vc-do-command |
2634 ;; See the SCCS case, above, regarding the | 2629 (current-buffer) 0 "co" file 'MASTER |
2635 ;; if-statement. | 2630 "-q" ;; suppress diagnostic output |
2636 (format "if [ x\"$1\" = x ]; then shift; fi; \ | 2631 (if writable "-l") |
2637 umask %o; exec >\"$1\" || exit; \ | 2632 (concat "-p" rev) |
2638 shift; umask %o; exec co \"$@\"" | 2633 switches)) |
2639 (logand 511 (lognot vc-modes)) | 2634 (set-file-modes filename |
2640 (logand 511 (lognot (default-file-modes)))) | 2635 (logior (file-modes (vc-name file)) |
2641 "" ; dummy argument for shell's $0 | 2636 (if writable 128 0))) |
2642 filename | 2637 (setq failed nil)) |
2643 (if writable "-l") | |
2644 (concat "-p" rev) | |
2645 switches) | |
2646 (setq failed nil)) | |
2647 (and failed (file-exists-p filename) (delete-file filename)))) | 2638 (and failed (file-exists-p filename) (delete-file filename)))) |
2648 (let (new-version) | 2639 (let (new-version) |
2649 ;; if we should go to the head of the trunk, | 2640 ;; if we should go to the head of the trunk, |
2650 ;; clear the default branch first | 2641 ;; clear the default branch first |
2651 (and rev (string= rev "") | 2642 (and rev (string= rev "") |
2682 (if workfile ;; CVS | 2673 (if workfile ;; CVS |
2683 ;; CVS is much like RCS | 2674 ;; CVS is much like RCS |
2684 (let ((failed t)) | 2675 (let ((failed t)) |
2685 (unwind-protect | 2676 (unwind-protect |
2686 (progn | 2677 (progn |
2687 (apply 'vc-do-command | 2678 (with-temp-file filename |
2688 nil 0 "/bin/sh" file 'WORKFILE "-c" | 2679 (apply 'vc-do-command |
2689 "exec >\"$1\" || exit; shift; exec cvs update \"$@\"" | 2680 (current-buffer) 0 "cvs" file 'WORKFILE |
2690 "" ; dummy argument for shell's $0 | 2681 "-Q" ;; suppress diagnostic output |
2691 workfile | 2682 "update" |
2692 (concat "-r" rev) | 2683 (concat "-r" rev) |
2693 "-p" | 2684 "-p" |
2694 switches) | 2685 switches)) |
2695 (setq failed nil)) | 2686 (setq failed nil)) |
2696 (and failed (file-exists-p filename) (delete-file filename)))) | 2687 (and failed (file-exists-p filename) (delete-file filename)))) |
2697 ;; default for verbose checkout: clear the sticky tag | 2688 ;; default for verbose checkout: clear the sticky tag |
2698 ;; so that the actual update will get the head of the trunk | 2689 ;; so that the actual update will get the head of the trunk |
2699 (and rev (string= rev "") | 2690 (and rev (string= rev "") |