Thursday, June 14, 2007

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.
]]]

Monday, June 4, 2007

Update 3: More on the WC class

Got a few (much more useful) features added to the wc class, including add, revert, delete, and a few more methods for getting various elements of the current state. I also had a working copy, before some unknown change made it not work.

My present work on the wc class is mostly guided by the idea that I want to finish the functions I'm most likely to use first. Add, revert, delete, and so on are some of the most common actions I take on a working copy, so I'm using those as a starting point for further work.

From here, I continue adding important methods to the wc class, as well as making it more user friendly and efficient. I've also updated my test script to be more useful and more formal, and I plan to continue to improve that as more features are added that need tests. I think I should have a solid enough version of wc to patch into the repository sometime this week. I want to make sure my work is solid before it gets subjected to too much review, but what I have now is at least a good start.

Friday, June 1, 2007

Update 2: Minor Updates, Renames, and the Beginning of WC

Done this week:

Some minor updates and renames to the existing ctypes python bindings, with the aim of making names and files logical. Changed things like "client" to "repository" to make it clear what it really is, moved helper functions out of client.py, etc.

Also this week, I started work on the wc class for the ctypes binding. At this point, I have three methods working more or less completely, those being:

text_modified - checks the status of a given path in the working copy to see if the text has been modified

prop_modified - just like text_modified, but for props.

has_conflict - check for conflicts in the given path. This is slightly incomplete, in that it doesn't yet identify the kind of conflict.

I don't have extensive test cases written for these yet, but I do have some simple tests to give me an idea what's working. Once I got past some of the basic problems of moving from reading code ment to work with ctypes to writing code to work with ctypes, things have started moving more smoothly.

Next week, I plan on continuing minor updates to the existing code while putting wc.py into good enough shape to be added to the repository. I also plan on writing more complete tests, and making automated tests for existing functionality.