/[meta-cvs]/meta-cvs/F-BE2DE9340254D8E8E6E2649A55D3A742
ViewVC logotype

Diff of /meta-cvs/F-BE2DE9340254D8E8E6E2649A55D3A742

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by kaz, Tue Dec 3 08:05:56 2002 UTC revision 1.10 by kaz, Sun Apr 13 14:39:12 2003 UTC
# Line 8  Line 8 
8    
9  (in-package "META-CVS")  (in-package "META-CVS")
10    
11  (defun synchronize-files (left-file right-file should-be-executable)  (defun synchronize-files (left-file right-file should-be-executable
12                              &key (direction :either))
13  "Ensure that the two files have the same contents, using any means,  "Ensure that the two files have the same contents, using any means,
14  including the possibility of making them hard links to the same object.  including the possibility of making them hard links to the same object.
15  If they are already the same object, nothing happens and the symbol  If they are already the same object, nothing happens and the symbol
# Line 30  happens, and NIL is returned. If either Line 31  happens, and NIL is returned. If either
31            :dir)            :dir)
32          ((not right)          ((not right)
33            (honor-dry-run (left-file right-file)            (honor-dry-run (left-file right-file)
34              (ensure-directories-exist right-file)              (exec-check left)
35              (link left-file right-file)              (or (unless (eq direction :left)
36              (exec-check left))                    (ensure-directories-exist right-file)
37            :left)                    (link left-file right-file)
38                      :left)
39                    :no-sync)))
40          ((not left)          ((not left)
41            (honor-dry-run (left-file right-file)            (honor-dry-run (left-file right-file)
42              (ensure-directories-exist left-file)              (exec-check right)
43              (link right-file left-file)              ;; Special case: do not re-create files missing in
44              (exec-check right))              ;; CVS sandbox! Either someone tampered with the sandbox,
45            :right)              ;; in which case we just let CVS resurrect the file,
46                ;; and a subsequent sync will properly have the clean-copy
47                ;; semantics, propagating the clean copy to the tree.
48                ;; Or else CVS itself made the file disappear, in which
49                ;; case if we restore it, CVS will later complain that the file
50                ;; is ``in the way''!
51                :no-sync))
52          ((same-file-p right left)          ((same-file-p right left)
53            (honor-dry-run (right-file)            (honor-dry-run (right-file)
54              (exec-check right))              (exec-check right))
55            :same)            :same)
56          ((older-p left right)          ((older-p left right)
57            (honor-dry-run (left-file right-file)            (honor-dry-run (left-file right-file)
58              (unlink left-file)              (exec-check right)
59              (link right-file left-file)              (or (unless (eq direction :right)
60              (exec-check right))                    (unlink left-file)
61            :right)                    (link right-file left-file)
62                      :right)
63                    :no-sync)))
64          ((older-p right left)          ((older-p right left)
65            (honor-dry-run (left-file right-file)            (honor-dry-run (left-file right-file)
66              (unlink right-file)              (exec-check left)
67              (link left-file right-file)              (or (unless (eq direction :left)
68              (exec-check left))                    (unlink right-file)
69            :left)                    (link left-file right-file)
70                      :left)
71                    :no-sync)))
72          (t          (t
73            (restart-case            (restart-case
74              (error "~a and ~a have the same modification time."              (ecase direction
75                     left-file right-file)                ((:right) (invoke-restart :choose-left))
76                  ((:left) (invoke-restart :choose-right))
77                  ((:either) (error "~a and ~a have the same modification time."
78                                    left-file right-file)))
79              (:choose-left () :report (lambda (s)              (:choose-left () :report (lambda (s)
80                                         (format s "take ~a; clobber ~a."                                         (format s "take ~a; clobber ~a."
81                                                 left-file right-file))                                                 left-file right-file))

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

  ViewVC Help
Powered by ViewVC 1.1.5