[Zope3-checkins] CVS: Zope3/src/zope/fssync - fssync.py:1.32 main.py:1.18
Guido van Rossum
guido@python.org
Tue, 10 Jun 2003 18:00:12 -0400
Update of /cvs-repository/Zope3/src/zope/fssync
In directory cvs.zope.org:/tmp/cvs-serv21991
Modified Files:
fssync.py main.py
Log Message:
Add -r flag to commit which adds a 'raise' option to the view.
In this case, the server raises SynchronizationError for conflicts,
rather than returning a list of conflict errors.
This is a debugging aid.
=== Zope3/src/zope/fssync/fssync.py 1.31 => 1.32 ===
--- Zope3/src/zope/fssync/fssync.py:1.31 Thu Jun 5 17:05:49 2003
+++ Zope3/src/zope/fssync/fssync.py Tue Jun 10 18:00:11 2003
@@ -316,13 +316,15 @@
for name in names:
method(join(target, name), *more)
- def commit(self, target, note="fssync_commit"):
+ def commit(self, target, note="fssync_commit", raise_on_conflicts=False):
entry = self.metadata.getentry(target)
if not entry:
raise Error("nothing known about", target)
self.network.loadrooturl(target)
path = entry["path"]
view = "@@fromFS.snarf?note=%s" % urllib.quote(note)
+ if raise_on_conflicts:
+ view += "&raise=1"
head, tail = split(realpath(target))
data = DataSource(head, tail)
fp, headers = self.network.httpreq(path, view, data)
=== Zope3/src/zope/fssync/main.py 1.17 => 1.18 ===
--- Zope3/src/zope/fssync/main.py:1.17 Thu Jun 5 17:05:49 2003
+++ Zope3/src/zope/fssync/main.py Tue Jun 10 18:00:11 2003
@@ -159,7 +159,7 @@
fs.checkout(target)
def commit(opts, args):
- """fssync commit [-m message] [TARGET ...]
+ """fssync commit [-m message] [-r] [TARGET ...]
Commit the TARGET files or directories to the Zope 3 server
identified by the checkout command. TARGET defaults to the
@@ -173,11 +173,14 @@
The default message is 'fssync'.
"""
message = "fssync_commit"
+ raise_on_conflicts = False
for o, a in opts:
if o in ("-m", "--message"):
message = a
+ if o in ("-r", "--raise-on-conflicts"):
+ raise_on_conflicts = True
fs = FSSync()
- fs.multiple(args, fs.commit, message)
+ fs.multiple(args, fs.commit, message, raise_on_conflicts)
def update(opts, args):
"""fssync update [TARGET ...]
@@ -294,7 +297,7 @@
"checkout": ("", [], checkout),
"co": ("", [], checkout),
"update": ("", [], update),
- "commit": ("m:", ["message="], commit),
+ "commit": ("m:r", ["message=", "raise-on-conflicts"], commit),
"add": ("", [], add),
"remove": ("", [], remove),
"rm": ("", [], remove),