Changeset 34


Ignore:
Timestamp:
Feb 22, 2010 5:14:43 PM (15 years ago)
Author:
retracile
Message:

Mergebot: begin refactoring svn layer, fix some errors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mergebot/trunk/mergebot/svn.py

    r33 r34  
    1010import subprocess
    1111
     12def shell_quote(self, string):
     13    """Given a string, escape the characters interpretted by the shell."""
     14    for char in ["\\", "\"", "$"]:
     15        string = string.replace(char, "\\%s" % (char, ))
     16    return '"%s"' % (string, )
     17
     18
    1219class SvnLib(object):
    1320    def __init__(self):
    1421        pass
    15 
    16     def shell_quote(self, string):
    17         """Given a string, escape the characters interpretted by the shell."""
    18         for char in ["\\", "\"", "$"]:
    19             string = string.replace(char, "\\%s" % (char, ))
    20         return '"%s"' % (string, )
    2122
    2223    def logcmd(self, cmd, logfile):
     
    5960        # If there have been no commits on the branch since it was created, there
    6061        # will only be one revision listed.... but the log will split into 3 parts.
    61         endrev = get_rev_from_log(logs[1])
    62         startrev = get_rev_from_log(logs[-2])
     62        endrev = self.get_rev_from_log(logs[1])
     63        startrev = self.get_rev_from_log(logs[-2])
    6364        return (startrev, endrev)
    6465
     
    6970            "svn copy --username=mergebot --password=mergebot -m %s %s %s" \
    7071            % (shell_quote(commit_message), from_url, to_url)
    71         return logcmd(svncmd, logfile)
     72        return self.logcmd(svncmd, logfile)
    7273
    7374    def delete_branch(self, url, commit_message, logfile):
     
    7879        svncmd = "svn rm --no-auth-cache --username=mergebot --password=mergebot " \
    7980            "-m %s %s 2>>%s" % (shell_quote(commit_message), url, logfile)
    80         return _svn_new_rev_command(svncmd)
     81        return self._svn_new_rev_command(svncmd)
    8182
    8283    def checkout(self, from_url, workingdir, logfile):
     
    120121            "--password=mergebot -m %s 2>>%s" % (workingdir,
    121122                shell_quote(commit_message), logfile)
    122         return _svn_new_rev_command(svncmd)
     123        return self._svn_new_rev_command(svncmd)
    123124
    124125    def _svn_new_rev_command(self, svncmd):
Note: See TracChangeset for help on using the changeset viewer.