##// END OF EJS Templates
purge: prevent a silly crash with --confirm --files...
marmoute -
r50624:0cc5f74f 6.1.4 stable
parent child Browse files
Show More
@@ -2442,6 +2442,7 b' def purge('
2442 status = repo.status(match=matcher, ignored=ignored, unknown=unknown)
2442 status = repo.status(match=matcher, ignored=ignored, unknown=unknown)
2443
2443
2444 if confirm:
2444 if confirm:
2445 msg = None
2445 nb_ignored = len(status.ignored)
2446 nb_ignored = len(status.ignored)
2446 nb_unknown = len(status.unknown)
2447 nb_unknown = len(status.unknown)
2447 if nb_unknown and nb_ignored:
2448 if nb_unknown and nb_ignored:
@@ -2463,12 +2464,12 b' def purge('
2463 b"permanently delete at least %d empty directories?"
2464 b"permanently delete at least %d empty directories?"
2464 )
2465 )
2465 msg %= dir_count
2466 msg %= dir_count
2466 else:
2467 if msg is None:
2467 # XXX we might be missing directory there
2468 return res
2468 return res
2469 else:
2469 msg += b" (yN)$$ &Yes $$ &No"
2470 msg += b" (yN)$$ &Yes $$ &No"
2470 if repo.ui.promptchoice(msg, default=1) == 1:
2471 if repo.ui.promptchoice(msg, default=1) == 1:
2471 raise error.CanceledError(_(b'removal cancelled'))
2472 raise error.CanceledError(_(b'removal cancelled'))
2472
2473
2473 if removefiles:
2474 if removefiles:
2474 for f in sorted(status.unknown + status.ignored):
2475 for f in sorted(status.unknown + status.ignored):
@@ -350,4 +350,9 b' remove both files and dirs'
350 .hg
350 .hg
351 .hgignore
351 .hgignore
352
352
353 Test some --confirm case that ended crashing
354
355 $ hg purge --confirm
356 $ hg purge --confirm --all --files
357
353 $ cd ..
358 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now