[Zope3-checkins] CVS: Zope3/src/zope/fssync - compare.py:1.2 fssync.py:1.15
Guido van Rossum
guido@python.org
Wed, 14 May 2003 15:18:16 -0400
Update of /cvs-repository/Zope3/src/zope/fssync
In directory cvs.zope.org:/tmp/cvs-serv13545
Modified Files:
compare.py fssync.py
Log Message:
Be more picky about merge conflicts.
A merge conflict (diff3 returning a nonzero exit status) causes
entry["conflict"] to be set to the mtime of the local file (the file
containinfg the conflict markers). The conflict is automatically
cleared when the file is modified in any way.
=== Zope3/src/zope/fssync/compare.py 1.1 => 1.2 ===
--- Zope3/src/zope/fssync/compare.py:1.1 Fri May 9 16:54:15 2003
+++ Zope3/src/zope/fssync/compare.py Wed May 14 15:18:15 2003
@@ -48,6 +48,9 @@
for x in rentries:
errors.append("missing working entry for %r" % join(left, x))
for x in common:
+ lentry, rentry = common[x]
+ if lentry.has_key("conflict"):
+ errors.append("unresolved conflict for %r" % join(left, x))
nx = normcase(x)
if nx in rnondirs:
# Compare files (directories are compared by the walk)
=== Zope3/src/zope/fssync/fssync.py 1.14 => 1.15 ===
--- Zope3/src/zope/fssync/fssync.py:1.14 Wed May 14 10:42:43 2003
+++ Zope3/src/zope/fssync/fssync.py Wed May 14 15:18:15 2003
@@ -36,7 +36,7 @@
from os.path import realpath, normcase, normpath
from zope.xmlpickle import loads, dumps
-from zope.fssync.compare import treeComparisonWalker, classifyContents
+from zope.fssync.compare import classifyContents
from zope.fssync.metadata import Metadata
from zope.fssync.merger import Merger
@@ -401,7 +401,7 @@
entry = self.metadata.getentry(target)
if not entry:
raise Error("diff target '%s' doesn't exist", target)
- if entry.get("flag"):
+ if "flag" in entry:
raise Error("diff target '%s' is added or deleted", target)
if isdir(target):
self.dirdiff(target, mode, diffopts)
@@ -424,7 +424,7 @@
for name in names:
t = join(target, name)
e = self.metadata.getentry(t)
- if e and not e.get("flag"):
+ if e and "flag" not in e:
self.diff(t, mode, diffopts)
def add(self, path):
@@ -549,6 +549,13 @@
letter = "U"
elif state == "Modified":
letter = "M"
+ entry = self.metadata.getentry(local)
+ conflict_mtime = entry.get("conflict")
+ if conflict_mtime:
+ if conflict_mtime == os.path.getmtime(local):
+ letter = "C"
+ else:
+ del entry["conflict"]
elif state == "Added":
letter = "A"
elif state == "Removed":