ViewVC logotype

Contents of /meta-cvs/F-BE2DE9340254D8E8E6E2649A55D3A742

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.6 - (hide annotations)
Fri Sep 6 02:17:27 2002 UTC (11 years, 7 months ago) by kaz
Branch: MAIN
CVS Tags: mcvs-0-24, mcvs-0-95, mcvs-0-98, mcvs-1-0-branch~branch-point, mcvs-0-97, mcvs-0-96
Branch point for: mcvs-1-0-branch
Changes since 1.5: +53 -42 lines
Low level support for versioning executable bit.

* code/unix-bindings/unix.lisp (unix-funcs:chmod): New callout

* code/clisp-unix.lisp (executable-p, make-executable,
make-non-executable): New generic functions.
(executable-p (file-info), make-executable (file-info),
make-executable (string), make-non-executable (file-info),
make-non-executable (string)): New methods.

* code/add.lisp (mcvs-add): Record whether new file is
executable or not, by setting executable slot in mapping-entry.

* code/create.lisp (mcvs-create): Likewise.

* code/sync.lisp (synchronize-files): New parameter,
should-be-executable, tells function which way to set
permissions after synchronizing files.

* code/mapping.lisp (mapping-entry): New slot, executable.
(mapping-entry-parse-attributes): New function, parses
new optional property list from :FILE entries in a mapping.
(mapping-convert-in): Parse property list that may be present in fourth
list element of a :FILE entry.
(mapping-convert-out): Write out executable flag as
:EXEC property, if true.
(mapping-synchronize): Pass executable flag down to synchronize-files.
1 kaz 1.3 ;;; This source file is part of the Meta-CVS program,
2 kaz 1.2 ;;; which is distributed under the GNU license.
3     ;;; Copyright 2002 Kaz Kylheku
5 kaz 1.1 (require "system")
6     (provide "sync")
8 kaz 1.6 (defun synchronize-files (left-file right-file should-be-executable)
9 kaz 1.1 "Ensure that the two files have the same contents, using any means,
10     including the possibility of making them hard links to the same object.
11     If they are already the same object, nothing happens and the symbol
12     :same is returned. Otherwise the newer one prevails, and clobbers the older
13     one; the symbols :left or :right are returned to indicate which prevailed. If
14     one of them doesn't exist, then it is created. If neither exists, nothing
15 kaz 1.4 happens, and NIL is returned. If either file is actually a directory,
16     :dir is returned"
17 kaz 1.6 (flet ((exec-check (file-info)
18     (if should-be-executable
19     (make-executable file-info)
20     (make-non-executable file-info))))
21     (let ((left (exists left-file))
22     (right (exists right-file)))
23     (cond
24     ((not (or left right))
25     nil)
26     ((or (directory-p left) (directory-p right))
27     :dir)
28     ((not right)
29     (ensure-directories-exist right-file)
30     (link left-file right-file)
31     (exec-check left-file)
32     :left)
33     ((not left)
34     (ensure-directories-exist left-file)
35     (link right-file left-file)
36     (exec-check right-file)
37     :right)
38     ((same-file-p right left)
39     (exec-check right-file)
40     :same)
41     ((older-p left right)
42     (unlink left-file)
43     (link right-file left-file)
44     (exec-check right-file)
45     :right)
46     ((older-p right left)
47     (unlink right-file)
48     (link left-file right-file)
49     (exec-check left-file)
50     :left)
51     (t
52     (restart-case
53     (error "~a and ~a have the same modification time."
54     left-file right-file)
55     (:choose-left () :report (lambda (s)
56     (format s "take ~a; clobber ~a."
57     left-file right-file))
58     (unlink right-file)
59     (link left-file right-file)
60     (exec-check left-file)
61     :left)
62     (:choose-right () :report (lambda (s)
63     (format s "take ~a; clobber ~a."
64     right-file left-file))
65     (unlink left-file)
66     (link right-file left-file)
67     (exec-check right-file)
68     :right)))))))

  ViewVC Help
Powered by ViewVC 1.1.5