[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] ctypes-python-bindings branch Rough WC Class

From: Sage La Torra <sagelt_at_gmail.com>
Date: 2007-06-15 01:11:43 CEST

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. Some functionality is still missing or not well implemented,
but it's a good start. In particular, this implementation does not
have a simple way to diff the entire working copy, it doesn't taker
advantage of cancel_func s much, etc.

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.

Hope the patch notes are good, I haven't submitted a patch for
anything this big before.

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.

To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Received on Fri Jun 15 01:12:04 2007

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.