Just a quick update about my work on the WC class. Probably the best way to summarize is to post the patch I just sent to the mailing list:
This patch adds a class representing the WC to the new python bindings. At present, it's a somewhat rough patch, but it does include some basic functionality.
Here's a rundown of the wc class, as it stands:
WC(path):Creates a new WC object for the working copy located at PATH. PATH defaults to the present working directory.
WC.info(): Returns a string with the same contents as 'svn diff' on the command line. Not critical, but useful.
WC.has_conflict(): If the WC has a conflict, return en entry for the conflicted file. Otherwise return False.
WC.delete(path): Schedules PATH for deletion in the next update.
WC.add(path): Schedules PATH for addition.
WC.copy(src,dest): Copies SRC to DEST, DEST will be scheduled for addition in the next revision.
WC.move(src,dest): Moves SRC to DEST. SRC will be deleted and scheduled for deletion, DEST will be scheduled for addition.
WC.revert(path, recurse, commit_time): Revert PATH. If RECURSE is true, directories will be recursed. If COMMIT_TIME is true, the last changed time will be changed to the commit time. RECURSE and COMMIT_TIME are True by default.
WC.revert_all(show_hidden): Revert everything in the wc. If SHOW_HIDDEN is true, hidden files will be reverted too. SHOW_HIDDEN is False by default.
WC.resolve(path): Resolve a conflict on PATH. Not thuroughly tested as of yet.
WC.text_modified(path): Returns True if the text of PATH has been modified.
WC.prop_modified(path): Returns True if the props of PATH have been modified.
WC.wc_entry(path, show_hidden): Returns an entry for PATH. If show_hidden is True (which it is by default), can generate an entry for a hidden file.
WC.is_scheduled_add(path): Returns True if PATH is scheduled for addition.
WC.is_scheduled_delete(path): Returns True if PATH is scheduled for deletion.
WC.diff_path(modified): Returns a string containing a diff of MODIFIED and it's original version. At present, only works for files that are in the repository (not files marked for addition).
svn_kind_to_string(kind): Convert an entry kind to a human-readable string.
svn_schedule_to_string(schedule): Convert an entry schedule to a human-readable srting.
A little more information about these functions can be found inline in wc.py.
I've also included wcexample.py, a simple example/test of the wc functionality. It's designed to be run in place, change a few things, and then revert the changes that it made.
[[[
Add a working copy class to the ctypes python bindings.
wc.py(WC, WC.info(), WC.text_modified(), WC.prop_modified(), WC.has_conflict(), WC.copy(), WC.move(), WC.delete(), WC.add(), WC.resolve(), WC.revert(), WC.revert_all(), WC.wc_entry(), WC.is_scheduled_add(), WC.is_scheduled_delete(), WC.diff_path(), svn_kind_to_string(), svn_schedule_to_string()): WC class and methods to handle simple operations.
]]]
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment