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

Contents of /meta-cvs/F-BE2DE9340254D8E8E6E2649A55D3A742

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Sun Jan 20 07:12:03 2002 UTC (12 years, 3 months ago) by kaz
Branch: MAIN
Adding all existing source files.
1 (require "system")
2 (provide "sync")
3
4 (defun synchronize-files (left-file right-file)
5 "Ensure that the two files have the same contents, using any means,
6 including the possibility of making them hard links to the same object.
7 If they are already the same object, nothing happens and the symbol
8 :same is returned. Otherwise the newer one prevails, and clobbers the older
9 one; the symbols :left or :right are returned to indicate which prevailed. If
10 one of them doesn't exist, then it is created. If neither exists, nothing
11 happens, and NIL is returned."
12 (let ((left (no-existence-error (stat left-file)))
13 (right (no-existence-error (stat right-file))))
14 (cond
15 ((not (or left right))
16 nil)
17 ((not right)
18 (ensure-directories-exist right-file)
19 (link left-file right-file)
20 :left)
21 ((not left)
22 (ensure-directories-exist left-file)
23 (link right-file left-file)
24 :right)
25 ((same-file-p right left)
26 :same)
27 ((older-p left right)
28 (unlink left-file)
29 (link right-file left-file)
30 :right)
31 (t
32 (unlink right-file)
33 (link left-file right-file)
34 :left))))

  ViewVC Help
Powered by ViewVC 1.1.5