Index: tools/push-to-trunk/common_includes.py |
diff --git a/tools/push-to-trunk/common_includes.py b/tools/push-to-trunk/common_includes.py |
index 39b68913426e3f845953434134339d6bd2e40d7c..6368a279f2309dc5ee2409cf0764fe3c5c6de8df 100644 |
--- a/tools/push-to-trunk/common_includes.py |
+++ b/tools/push-to-trunk/common_includes.py |
@@ -257,10 +257,11 @@ class Step(GitRecipesMixin): |
return |
print ">>> Step %d: %s" % (self._number, self._text) |
- self.RunStep() |
- |
- # Persist state. |
- TextToFile(json.dumps(self._state), state_file) |
+ try: |
+ return self.RunStep() |
+ finally: |
+ # Persist state. |
+ TextToFile(json.dumps(self._state), state_file) |
def RunStep(self): # pragma: no cover |
raise NotImplementedError |
@@ -555,7 +556,8 @@ class ScriptsBase(object): |
steps.append(MakeStep(step_class, number, self._state, self._config, |
options, self._side_effect_handler)) |
for step in steps[options.step:]: |
- step.Run() |
+ if step.Run(): |
+ return 1 |
return 0 |
def Run(self, args=None): |