[Zope3-checkins] CVS: Zope3/src/zope/fssync - fsmerger.py:1.6 merger.py:1.11
Guido van Rossum
guido@python.org
Thu, 29 May 2003 11:08:00 -0400
Update of /cvs-repository/Zope3/src/zope/fssync
In directory cvs.zope.org:/tmp/cvs-serv32663
Modified Files:
fsmerger.py merger.py
Log Message:
Proper unit tests for "sticky conflicts" (the "C" flag remains until
the file is edited) and proper implementation following the unit tests.
=== Zope3/src/zope/fssync/fsmerger.py 1.5 => 1.6 ===
--- Zope3/src/zope/fssync/fsmerger.py:1.5 Wed May 28 15:09:55 2003
+++ Zope3/src/zope/fssync/fsmerger.py Thu May 29 11:07:29 2003
@@ -66,6 +66,13 @@
def merge_files(self, local, remote):
"""Merge remote file into local file."""
+
+ # Reset sticky conflict if file was edited
+ entry = self.metadata.getentry(local)
+ conflict = entry.get("conflict")
+ if conflict and conflict != os.path.getmtime(local):
+ del entry["conflict"]
+
original = fsutil.getoriginal(local)
action, state = self.merger.classify_files(local, original, remote)
state = self.merger.merge_files(local, original, remote,
=== Zope3/src/zope/fssync/merger.py 1.10 => 1.11 ===
--- Zope3/src/zope/fssync/merger.py:1.10 Wed May 28 18:30:53 2003
+++ Zope3/src/zope/fssync/merger.py Thu May 29 11:07:29 2003
@@ -204,6 +204,10 @@
lmeta = self.getentry(local)
rmeta = self.getentry(remote)
+ # Special-case sticky conflict
+ if "conflict" in lmeta:
+ return ("Nothing", "Conflict")
+
# Sort out cases involving additions or removals
if not lmeta and not rmeta:
@@ -262,10 +266,6 @@
return ("Nothing", "Uptodate")
else:
# Only local changes
- if "conflict" in lmeta:
- if lmeta["conflict"] == os.path.getmtime(local):
- return ("Nothing", "Conflict")
- del lmeta["conflict"]
return ("Nothing", "Modified")
else:
# Some local changes; classify local changes