Anonymous avatar Anonymous committed 3c64839

Port to new Rietveld API.

Comments (0)

Files changed (1)

scripts/addpatchsets

 from codereview.models import (Repository, Branch, Patch, 
                                PatchSet, Issue, Content)
 from django.contrib.auth.models import User
-from codereview import engine, patching
+from codereview import patching, utils
 from roundup_helper.models import File, RoundupIssue
 from django.db import connection, transaction
 from google.appengine.ext import db as gae_db
         # been a non-empty base, patching will fail.
         base = ""
     else:
-        base = engine.UnifyLinebreaks(r.read())
+        base = utils.unify_linebreaks(r.read())
     lines = base.splitlines(True)
     for (start, end), newrange, oldlines, newlines in chunks:
         if lines[start:end] != oldlines:
         issue = issue[0]
     if verbose:
         print "Doing", f.id
-    data = engine.UnifyLinebreaks(data)
+    data = utils.unify_linebreaks(data)
     branch, bases = find_bases(data)
     if not branch:
         if f.id < 15000:
 
     blob = gae_db.Blob(data)
     patchset = PatchSet(issue=issue, data=blob, parent=issue,
-                        owner=User.objects.get(id=f._creator),
                         created=f._creation, modified=f._creation)
     patchset.put()
     issue.patchset=patchset
     f._patchset = str(patchset.id)
     f.save()
     for filename, data, chunks, base in bases:
-        patch = Patch(patchset=patchset, text=engine.ToText(data),
+        patch = Patch(patchset=patchset, text=utils.to_dbtext(data),
                       filename=filename, parent=patchset)
         patch.put()
-        content = Content(text=engine.ToText(base), parent=patch)
+        content = Content(text=utils.to_dbtext(base), parent=patch)
         content.put()
         patch.content = content
         patch.put()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.