I want to use pysvn
to determine the revision of a working copy and whether its contents are identical to those in the repository (for the same revision).
Getting the revision number was no problem, but how can I find out whether there are any uncommitted changes in the working copy. So what I am looking for the equivalent of checking whether svn status --ignore-externals
has no lines not starting with X
.
I managed to do it using:
def has_no_modifications(path_to_repository)
statuses = client.status(path_to_repository, ignore=True, recurse=True)
statuses = [s for s in statuses if s.data['text_status'] != pysvn.wc_status_kind.normal]
return len(statuses) == 0