changeset 20565:f1c3ba167b0c stable

purge: avoid duplicate output for --print (issue4092) Now "hg purge -p" commands avoids printiing duplication of filenames. Second patch is the test coverage of first patch which tells that '-p' does not depend on whether ui.verbose is configured or not,that means it is independent of '-v'.
author anuraggoel <anurag.dsps@gmail.com>
date Tue, 25 Feb 2014 06:30:21 +0530
parents 35ac807f941c
children d7eb839535d1 3d77e567de56
files hgext/purge.py tests/test-purge.t
diffstat 2 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/purge.py	Mon Feb 24 18:48:48 2014 -0600
+++ b/hgext/purge.py	Tue Feb 25 06:30:21 2014 +0530
@@ -101,10 +101,12 @@
     status = repo.status(match=match, ignored=opts['all'], unknown=True)
 
     for f in sorted(status[4] + status[5]):
-        ui.note(_('removing file %s\n') % f)
+        if act:
+            ui.note(_('removing file %s\n') % f)
         remove(removefile, f)
 
     for f in sorted(directories, reverse=True):
         if match(f) and not os.listdir(repo.wjoin(f)):
-            ui.note(_('removing directory %s\n') % f)
+            if act:
+                ui.note(_('removing directory %s\n') % f)
             remove(os.rmdir, f)
--- a/tests/test-purge.t	Mon Feb 24 18:48:48 2014 -0600
+++ b/tests/test-purge.t	Tue Feb 25 06:30:21 2014 +0530
@@ -21,7 +21,7 @@
 delete an empty directory
 
   $ mkdir empty_dir
-  $ hg purge -p
+  $ hg purge -p -v
   empty_dir
   $ hg purge -v
   removing directory empty_dir