diff treepkg/subversion.py @ 0:f78a02e79c84

initial checkin
author Bernhard Herzog <bh@intevation.de>
date Tue, 06 Mar 2007 17:37:32 +0100
parents
children 3e610233ccfe
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/treepkg/subversion.py	Tue Mar 06 17:37:32 2007 +0100
@@ -0,0 +1,37 @@
+# Copyright (C) 2007 by Intevation GmbH
+# Authors:
+# Bernhard Herzog <bh@intevation.de>
+#
+# This program is free software under the GPL (>=v2)
+# Read the file COPYING coming with the software for details.
+
+"""Collection of subversion utility functions"""
+
+import os
+
+import run
+from util import extract_value_for_key
+
+
+def checkout(url, localdir):
+    """Runs svn to checkout the repository at url into the localdir"""
+    run.call(["svn", "checkout", "-q", url, localdir])
+
+def update(localdir):
+    """Runs svn update on the localdir"""
+    run.call(["svn", "update", "-q", localdir])
+
+def export(src, dest):
+    """Runs svn export src dest"""
+    run.call(["svn", "export", "-q", src, dest])
+
+def last_changed_revision(svn_working_copy):
+    """return the last changed revision of an SVN working copy as an int"""
+    # Make sure we run svn under the C locale to avoid localized
+    # messages
+    env = os.environ.copy()
+    env["LANG"] = "C"
+
+    output = run.capture_output(["svn", "info", svn_working_copy], env=env)
+    return int(extract_value_for_key(output.splitlines(),
+                                     "Last Changed Rev:"))
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)