Show More
@@ -554,6 +554,15 b' class queue(object):' | |||
|
554 | 554 | except OSError, inst: |
|
555 | 555 | self.ui.warn(_('error removing undo: %s\n') % str(inst)) |
|
556 | 556 | |
|
557 | def backup(self, repo, files): | |
|
558 | # backup local changes in --force case | |
|
559 | for f in sorted(files): | |
|
560 | absf = repo.wjoin(f) | |
|
561 | if os.path.lexists(absf): | |
|
562 | self.ui.note(_('saving current version of %s as %s\n') % | |
|
563 | (f, f + '.orig')) | |
|
564 | util.rename(absf, absf + '.orig') | |
|
565 | ||
|
557 | 566 | def printdiff(self, repo, diffopts, node1, node2=None, files=None, |
|
558 | 567 | fp=None, changes=None, opts={}): |
|
559 | 568 | stat = opts.get('stat') |
@@ -1313,8 +1322,10 b' class queue(object):' | |||
|
1313 | 1322 | break |
|
1314 | 1323 | update = needupdate |
|
1315 | 1324 | |
|
1316 | if not force and update: | |
|
1317 | self.checklocalchanges(repo) | |
|
1325 | tobackup = set() | |
|
1326 | if update: | |
|
1327 | m, a, r, d = self.checklocalchanges(repo, force=force) | |
|
1328 | tobackup.update(m + a) | |
|
1318 | 1329 | |
|
1319 | 1330 | self.applieddirty = True |
|
1320 | 1331 | end = len(self.applied) |
@@ -1344,6 +1355,10 b' class queue(object):' | |||
|
1344 | 1355 | m, a, r, d = repo.status(qp, top)[:4] |
|
1345 | 1356 | if d: |
|
1346 | 1357 | raise util.Abort(_("deletions found between repo revs")) |
|
1358 | ||
|
1359 | # backup local changes in --force case | |
|
1360 | self.backup(repo, set(a + m + r) & tobackup) | |
|
1361 | ||
|
1347 | 1362 | for f in a: |
|
1348 | 1363 | try: |
|
1349 | 1364 | util.unlinkpath(repo.wjoin(f)) |
@@ -150,3 +150,41 b' and now we try it one more time with a u' | |||
|
150 | 150 | abort: cannot push to a previous patch: a |
|
151 | 151 | [255] |
|
152 | 152 | |
|
153 | test qpop --force and backup files | |
|
154 | ||
|
155 | $ hg qpop -a | |
|
156 | popping b | |
|
157 | patch queue now empty | |
|
158 | $ hg qq --create force | |
|
159 | $ echo a > a | |
|
160 | $ echo b > b | |
|
161 | $ echo c > c | |
|
162 | $ hg ci -Am add a b c | |
|
163 | $ echo a >> a | |
|
164 | $ hg rm b | |
|
165 | $ hg rm c | |
|
166 | $ hg qnew p1 | |
|
167 | $ echo a >> a | |
|
168 | $ echo bb > b | |
|
169 | $ hg add b | |
|
170 | $ echo cc > c | |
|
171 | $ hg add c | |
|
172 | $ hg qpop --force --verbose | |
|
173 | saving current version of a as a.orig | |
|
174 | saving current version of b as b.orig | |
|
175 | saving current version of c as c.orig | |
|
176 | popping p1 | |
|
177 | patch queue now empty | |
|
178 | $ hg st | |
|
179 | ? a.orig | |
|
180 | ? b.orig | |
|
181 | ? c.orig | |
|
182 | ? untracked-file | |
|
183 | $ cat a.orig | |
|
184 | a | |
|
185 | a | |
|
186 | a | |
|
187 | $ cat b.orig | |
|
188 | bb | |
|
189 | $ cat c.orig | |
|
190 | cc |
General Comments 0
You need to be logged in to leave comments.
Login now