gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r747656 - in /gump/trunk/python/gump/core/update: scmupdater.py svn.py
Date Wed, 25 Feb 2009 04:54:17 GMT
Author: bodewig
Date: Wed Feb 25 04:54:17 2009
New Revision: 747656

URL: http://svn.apache.org/viewvc?rev=747656&view=rev
Log:
Make svn detect a bad working copy

Modified:
    gump/trunk/python/gump/core/update/scmupdater.py
    gump/trunk/python/gump/core/update/svn.py

Modified: gump/trunk/python/gump/core/update/scmupdater.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/update/scmupdater.py?rev=747656&r1=747655&r2=747656&view=diff
==============================================================================
--- gump/trunk/python/gump/core/update/scmupdater.py (original)
+++ gump/trunk/python/gump/core/update/scmupdater.py Wed Feb 25 04:54:17 2009
@@ -20,9 +20,10 @@
 
 from gump import log
 
-from gump.core.model.workspace import CommandWorkItem, execute, \
+from gump.core.model.workspace import CommandWorkItem, \
     REASON_UPDATE_FAILED, STATE_FAILED, STATE_SUCCESS, WORK_TYPE_UPDATE
 from gump.core.run.gumprun import RunSpecific
+from gump.util.process.launcher import execute
 from gump.util.tools import wipeDirectoryTree
 
 def should_be_quiet(module):

Modified: gump/trunk/python/gump/core/update/svn.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/update/svn.py?rev=747656&r1=747655&r2=747656&view=diff
==============================================================================
--- gump/trunk/python/gump/core/update/svn.py (original)
+++ gump/trunk/python/gump/core/update/svn.py Wed Feb 25 04:54:17 2009
@@ -16,9 +16,14 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+import re
+import StringIO
+
 from gump import log
-from gump.core.model.workspace import Cmd
 from gump.core.update.scmupdater import ScmUpdater, should_be_quiet
+from gump.util.process.command import Cmd
+from gump.util.process.launcher import execute
+from gump.util.tools import catFile
 
 def getCommand(module, forUpdate):
     """
@@ -68,6 +73,8 @@
         
     return cmd
 
+URL_REGEX = re.compile('^URL:\s+(.*)\s*$', re.MULTILINE | re.UNICODE)
+
 ###############################################################################
 # Classes
 ###############################################################################
@@ -93,3 +100,35 @@
         """
         return getCommand(module, True)
 
+    def workspaceMatchesModule(self, module):
+        """
+            Run svn info to see whether the URL matches
+        """
+        cmd = Cmd('svn', 'check_workspace_' + module.getName(), 
+                  module.getSourceControlStagingDirectory())
+        cmd.addParameter('info')
+
+        result = execute(cmd)
+
+        output = None
+        if result.hasOutput():
+            stream = StringIO.StringIO()
+            catFile(stream, result.getOutput())
+            output = stream.getvalue()
+            stream.close()
+
+        if not result.isOk():
+            return (False, 'svn info returned ' + str(result.exit_code))
+
+        elif not output:
+            return (False, 'svn info didn\'t return any output.')
+
+        match = URL_REGEX.search(output)
+        if not match:
+            return (False, 'Couldn\'t find URL in svn info output ' + output)
+
+        expectedURL = module.getScm().getRootUrl()
+        actualURL = match.group(1)
+
+        return (expectedURL == actualURL, 'Expected URL \'' + expectedURL + \
+                    '\' but working copy was \'' + actualURL + '\'')



Mime
View raw message