summaryrefslogtreecommitdiffstats
path: root/subcmds
diff options
context:
space:
mode:
Diffstat (limited to 'subcmds')
-rw-r--r--subcmds/rebase.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/subcmds/rebase.py b/subcmds/rebase.py
index 7c8e9389..20662b11 100644
--- a/subcmds/rebase.py
+++ b/subcmds/rebase.py
@@ -52,6 +52,9 @@ branch but need to incorporate new upstream changes "underneath" them.
52 p.add_option('--whitespace', 52 p.add_option('--whitespace',
53 dest='whitespace', action='store', metavar='WS', 53 dest='whitespace', action='store', metavar='WS',
54 help='Pass --whitespace to git rebase') 54 help='Pass --whitespace to git rebase')
55 p.add_option('--auto-stash',
56 dest='auto_stash', action='store_true',
57 help='Stash local modifications before starting')
55 58
56 def Execute(self, opt, args): 59 def Execute(self, opt, args):
57 all = self.GetProjects(args) 60 all = self.GetProjects(args)
@@ -103,5 +106,23 @@ branch but need to incorporate new upstream changes "underneath" them.
103 print >>sys.stderr, '# %s: rebasing %s -> %s' % \ 106 print >>sys.stderr, '# %s: rebasing %s -> %s' % \
104 (project.relpath, cb, upbranch.LocalMerge) 107 (project.relpath, cb, upbranch.LocalMerge)
105 108
109 needs_stash = False
110 if opt.auto_stash:
111 stash_args = ["update-index", "--refresh", "-q"]
112
113 if GitCommand(project, stash_args).Wait() != 0:
114 needs_stash = True
115 # Dirty index, requires stash...
116 stash_args = ["stash"]
117
118 if GitCommand(project, stash_args).Wait() != 0:
119 return -1
120
106 if GitCommand(project, args).Wait() != 0: 121 if GitCommand(project, args).Wait() != 0:
107 return -1 122 return -1
123
124 if needs_stash:
125 stash_args.append('pop')
126 stash_args.append('--quiet')
127 if GitCommand(project, stash_args).Wait() != 0:
128 return -1