Fix svn commit for deleted files in release scripts.
authormachenbach@chromium.org <machenbach@chromium.org>
Mon, 3 Nov 2014 13:17:02 +0000 (13:17 +0000)
committermachenbach@chromium.org <machenbach@chromium.org>
Mon, 3 Nov 2014 13:17:15 +0000 (13:17 +0000)
BUG=408523
LOG=n
TEST=script_test.py
TBR=tandrii@chromium.org

Review URL: https://codereview.chromium.org/685623004

Cr-Commit-Position: refs/heads/master@{#25070}
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@25070 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

tools/push-to-trunk/common_includes.py
tools/push-to-trunk/test_scripts.py

index e95d555..bb040f5 100644 (file)
@@ -736,8 +736,18 @@ class Step(GitRecipesMixin):
                         (root, self._config["PATCH_FILE"]),
                         cwd=self._options.svn):
       self.Die("Could not apply patch.")
-    # Recursively add possibly newly added files.
-    self.Command("svn", "add --force %s" % root, cwd=self._options.svn)
+    for line in self.Command(
+        "svn", "status", cwd=self._options.svn).splitlines():
+      # Check for added and removed items. Svn status has seven status columns.
+      # The first contains ? for unknown and ! for missing.
+      match = re.match(r"^(.)...... (.*)$", line)
+      if match and match.group(1) == "?":
+        self.Command("svn", "add --force %s" % match.group(2),
+                     cwd=self._options.svn)
+      if match and match.group(1) == "!":
+        self.Command("svn", "delete --force %s" % match.group(2),
+                     cwd=self._options.svn)
+
     self.Command(
         "svn",
         "commit --non-interactive --username=%s --config-dir=%s -m \"%s\"" %
index 6eeb323..6d1aec5 100644 (file)
@@ -963,7 +963,10 @@ Performance and stability improvements on all platforms.""", commit)
       Cmd("svn status", "", cwd=svn_root),
       Cmd("patch -d trunk -p1 -i %s" %
           TEST_CONFIG["PATCH_FILE"], "Applied patch...", cwd=svn_root),
-      Cmd("svn add --force trunk", "", cwd=svn_root),
+      Cmd("svn status", "M       OWNERS\n?       new_file\n!       AUTHORS",
+          cwd=svn_root),
+      Cmd("svn add --force new_file", "", cwd=svn_root),
+      Cmd("svn delete --force AUTHORS", "", cwd=svn_root),
       Cmd("svn commit --non-interactive --username=author@chromium.org "
           "--config-dir=[CONFIG_DIR] "
           "-m \"Version 3.22.5 (based on push_hash)\"",
@@ -1786,7 +1789,7 @@ git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3456 0039-1c4b
       Cmd("svn status", "", cwd=svn_root),
       Cmd("patch -d branches/bleeding_edge -p1 -i %s" %
           TEST_CONFIG["PATCH_FILE"], "Applied patch...", cwd=svn_root),
-      Cmd("svn add --force branches/bleeding_edge", "", cwd=svn_root),
+     Cmd("svn status", "M       src/version.cc", cwd=svn_root),
       Cmd("svn commit --non-interactive --username=author@chromium.org "
           "--config-dir=[CONFIG_DIR] "
           "-m \"[Auto-roll] Bump up version to 3.11.6.0\"",