]> scripts.mit.edu Git - wizard.git/commitdiff
Add --rr-cache option to upgrade.
authorEdward Z. Yang <ezyang@mit.edu>
Mon, 18 Jan 2010 04:21:42 +0000 (23:21 -0500)
committerEdward Z. Yang <ezyang@mit.edu>
Mon, 18 Jan 2010 04:35:08 +0000 (23:35 -0500)
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
wizard/command/upgrade.py

index 388f00aeae8bba988483e4f368fd7f631d9d8fab..aae43eee3fc309ff8b1335a03b444e2d48941360 100644 (file)
@@ -242,6 +242,12 @@ class Upgrade(object):
         def resolve_conflicts():
             return self.wc.resolveConflicts()
         shell.call("git", "config", "merge.conflictstyle", "diff3")
+        # setup rerere
+        if self.options.rr_cache is None:
+            self.options.rr_cache = os.path.join(self.prod.location, ".git", "rr-cache")
+        if not os.path.exists(self.options.rr_cache):
+            os.mkdir(self.options.rr_cache)
+        os.symlink(self.options.rr_cache, os.path.join(self.wc.location, ".git", "rr-cache"))
         shell.call("git", "config", "rerere.enabled", "true")
         try:
             merge.merge(self.wc.app_version.scripts_tag, self.version,
@@ -413,6 +419,9 @@ of the conflicted working tree to stdout, separated by a space."""
             default=False, help="Force running upgrade even if it's already at latest version.")
     parser.add_option("--non-interactive", dest="non_interactive", action="store_true",
             default=False, help="Don't drop to shell in event of conflict.")
+    parser.add_option("--rr-cache", dest="rr_cache", metavar="PATH",
+            default=None, help="Use this folder to reuse recorded merge resolutions.  Defaults to"
+            "your production copy's rr-cache, if it exists.")
     baton.push(parser, "srv_path")
     options, args = parser.parse_all(argv)
     if len(args) > 1: