Changeset 55 for mergebot/trunk


Ignore:
Timestamp:
Feb 23, 2010 7:45:55 PM (15 years ago)
Author:
retracile
Message:

Mergebot: work on handling subversion 1.6 merge output

File:
1 edited

Legend:

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

    r50 r55  
    131131        skipped_regex = re.compile("Skipped.* '(.*)'", re.M)
    132132        start_rev, end_rev = revision_range
    133         pipe = os.popen("cd %s && svn merge --revision %s:%s %s . 2>>%s" % \
    134             (workingdir, start_rev, end_rev, from_url, logfile))
    135         output = pipe.readlines()
     133        pipe = subprocess.Popen(['svn', 'merge', '--non-interactive', '--revision', '%s:%s' % (start_rev, end_rev), from_url, '.'],
     134            cwd = workingdir,
     135            stdout = subprocess.PIPE,
     136            stderr = open(logfile, 'a')
     137        )
     138        output, _stderr = pipe.communicate()
    136139        # FIXME: check pipe.close for errors
     140        # errorcode = pipe.wait()
    137141        results = []
    138         for line in output:
    139             if line.startswith("Skipped"):
     142        for line in output.split('\n'):
     143            if line == '':
     144                continue # ignore blank lines
     145            elif line.startswith("Skipped"):
    140146                # This kind of conflict requires special handling.
    141147                filename = skipped_regex.findall(line)[0]
     
    143149            elif line.startswith("--- Merging r"):
    144150                continue # ignore the line
     151            elif line == 'Summary of conflicts:':
     152                continue # ignore the line
     153            elif line.startswith('  Text conflicts:'):
     154                continue # ignore the line
     155            # TODO: Tree conflicts
    145156            else:
    146                 assert line[4] == ' ', "Unexpected output from svn merge " \
    147                     "operation; the 5th character should always be a space." \
    148                     "  Output was %r." % line
     157                assert len(line) > 4 and line[4] == ' ', "Unexpected output " \
     158                    "from svn merge operation; the 5th character should " \
     159                    "always be a space.  Invalid output line was %r.\nFull output was: %r." % (line, output)
    149160                filename = line[5:-1] # (strip trailing newline)
    150161                status = line[:4].rstrip()
Note: See TracChangeset for help on using the changeset viewer.