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

Contents of /meta-cvs/F-BE2DE9340254D8E8E6E2649A55D3A742

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations)
Thu Jan 31 05:35:02 2002 UTC (12 years, 2 months ago) by kaz
Branch: MAIN
CVS Tags: mcvs-0-3, mcvs-0-2, mcvs-0-4
Changes since 1.2: +1 -1 lines
MCVS is being renamed to Meta-CVS.
1 ;;; This source file is part of the Meta-CVS program,
2 ;;; which is distributed under the GNU license.
3 ;;; Copyright 2002 Kaz Kylheku
4
5 (require "system")
6 (provide "sync")
7
8 (defun synchronize-files (left-file right-file)
9 "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 happens, and NIL is returned."
16 (let ((left (no-existence-error (stat left-file)))
17 (right (no-existence-error (stat right-file))))
18 (cond
19 ((not (or left right))
20 nil)
21 ((not right)
22 (ensure-directories-exist right-file)
23 (link left-file right-file)
24 :left)
25 ((not left)
26 (ensure-directories-exist left-file)
27 (link right-file left-file)
28 :right)
29 ((same-file-p right left)
30 :same)
31 ((older-p left right)
32 (unlink left-file)
33 (link right-file left-file)
34 :right)
35 (t
36 (unlink right-file)
37 (link left-file right-file)
38 :left))))

  ViewVC Help
Powered by ViewVC 1.1.5