Patchwork purge: avoid duplicate output for --print (issue4092)

login
register
mail settings
Submitter Anurag Goel
Date Feb. 13, 2014, 9:38 p.m.
Message ID <c3f90f494d184aa611b9.1392327521@ubuntu.ubuntu-domain>
Download mbox | patch
Permalink /patch/3636/
State Superseded
Commit f1c3ba167b0c73207c726b5a68c59c9b14560d2e
Headers show

Comments

Matt Mackall - Feb. 13, 2014, 8:11 p.m.
On Fri, 2014-02-14 at 03:08 +0530, Anurag Goel wrote:
> # HG changeset patch
> # User anuraggoel <anurag.dsps@gmail.com>
> # Date 1392327404 -19800
> #      Fri Feb 14 03:06:44 2014 +0530
> # Node ID c3f90f494d184aa611b9e3d4d3c6f28f8354cbe5
> # Parent  d98ba4a87427ce601dd23de8d4f5288cc44fe945
> purge: avoid duplicate output for --print (issue4092)

Looks good, but no test.

What single character can you add to the existing tests/test-purge.t to
test the new behavior?
Matt Mackall - Feb. 13, 2014, 8:57 p.m.
On Fri, 2014-02-14 at 04:24 +0530, Anurag Goel wrote:
> As i have go through the tests/test-purge.t , there is no test case for
> '--print0'.
> So i guess you are talking about to add '-0' single character to test new
> behaviour.

Nope. How will that show "avoid duplicate output" works?

Hint: http://bz.selenic.com/show_bug.cgi?id=4092#c1

> 
> On Fri, Feb 14, 2014 at 1:41 AM, Matt Mackall <mpm@selenic.com> wrote:
> 
> > On Fri, 2014-02-14 at 03:08 +0530, Anurag Goel wrote:
> > > # HG changeset patch
> > > # User anuraggoel <anurag.dsps@gmail.com>
> > > # Date 1392327404 -19800
> > > #      Fri Feb 14 03:06:44 2014 +0530
> > > # Node ID c3f90f494d184aa611b9e3d4d3c6f28f8354cbe5
> > > # Parent  d98ba4a87427ce601dd23de8d4f5288cc44fe945
> > > purge: avoid duplicate output for --print (issue4092)
> >
> > Looks good, but no test.
> >
> > What single character can you add to the existing tests/test-purge.t to
> > test the new behavior?
> >
> > --
> > Mathematics is the supreme nostalgia of our time.
> >
> >
> >
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Anurag Goel - Feb. 13, 2014, 9:38 p.m.
# HG changeset patch
# User anuraggoel <anurag.dsps@gmail.com>
# Date 1392327404 -19800
#      Fri Feb 14 03:06:44 2014 +0530
# Node ID c3f90f494d184aa611b9e3d4d3c6f28f8354cbe5
# Parent  d98ba4a87427ce601dd23de8d4f5288cc44fe945
purge: avoid duplicate output for --print (issue4092)
Sean Farley - Feb. 13, 2014, 10:30 p.m.
Anurag Goel <anurag.dsps@gmail.com> writes:

> # HG changeset patch
> # User anuraggoel <anurag.dsps@gmail.com>
> # Date 1392327404 -19800
> #      Fri Feb 14 03:06:44 2014 +0530
> # Node ID c3f90f494d184aa611b9e3d4d3c6f28f8354cbe5
> # Parent  d98ba4a87427ce601dd23de8d4f5288cc44fe945
> purge: avoid duplicate output for --print (issue4092)
>
> diff -r d98ba4a87427 -r c3f90f494d18 hgext/purge.py
> --- a/hgext/purge.py	Mon Feb 10 17:31:26 2014 -0600
> +++ b/hgext/purge.py	Fri Feb 14 03:06:44 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)

This is much better and seems to work as expected. Other crew members
have anything else to add?
Anurag Goel - Feb. 13, 2014, 10:54 p.m.
As i have go through the tests/test-purge.t , there is no test case for
'--print0'.
So i guess you are talking about to add '-0' single character to test new
behaviour.


On Fri, Feb 14, 2014 at 1:41 AM, Matt Mackall <mpm@selenic.com> wrote:

> On Fri, 2014-02-14 at 03:08 +0530, Anurag Goel wrote:
> > # HG changeset patch
> > # User anuraggoel <anurag.dsps@gmail.com>
> > # Date 1392327404 -19800
> > #      Fri Feb 14 03:06:44 2014 +0530
> > # Node ID c3f90f494d184aa611b9e3d4d3c6f28f8354cbe5
> > # Parent  d98ba4a87427ce601dd23de8d4f5288cc44fe945
> > purge: avoid duplicate output for --print (issue4092)
>
> Looks good, but no test.
>
> What single character can you add to the existing tests/test-purge.t to
> test the new behavior?
>
> --
> Mathematics is the supreme nostalgia of our time.
>
>
>
Anurag Goel - Feb. 13, 2014, 11:06 p.m.
Then , i guess you talking about adding '-v' to test the above changes in
the program.


On Fri, Feb 14, 2014 at 2:27 AM, Matt Mackall <mpm@selenic.com> wrote:

> On Fri, 2014-02-14 at 04:24 +0530, Anurag Goel wrote:
> > As i have go through the tests/test-purge.t , there is no test case for
> > '--print0'.
> > So i guess you are talking about to add '-0' single character to test new
> > behaviour.
>
> Nope. How will that show "avoid duplicate output" works?
>
> Hint: http://bz.selenic.com/show_bug.cgi?id=4092#c1
>
> >
> > On Fri, Feb 14, 2014 at 1:41 AM, Matt Mackall <mpm@selenic.com> wrote:
> >
> > > On Fri, 2014-02-14 at 03:08 +0530, Anurag Goel wrote:
> > > > # HG changeset patch
> > > > # User anuraggoel <anurag.dsps@gmail.com>
> > > > # Date 1392327404 -19800
> > > > #      Fri Feb 14 03:06:44 2014 +0530
> > > > # Node ID c3f90f494d184aa611b9e3d4d3c6f28f8354cbe5
> > > > # Parent  d98ba4a87427ce601dd23de8d4f5288cc44fe945
> > > > purge: avoid duplicate output for --print (issue4092)
> > >
> > > Looks good, but no test.
> > >
> > > What single character can you add to the existing tests/test-purge.t to
> > > test the new behavior?
> > >
> > > --
> > > Mathematics is the supreme nostalgia of our time.
> > >
> > >
> > >
> > _______________________________________________
> > Mercurial-devel mailing list
> > Mercurial-devel@selenic.com
> > http://selenic.com/mailman/listinfo/mercurial-devel
>
> --
> Mathematics is the supreme nostalgia of our time.
>
>
>

Patch

diff -r d98ba4a87427 -r c3f90f494d18 hgext/purge.py
--- a/hgext/purge.py	Mon Feb 10 17:31:26 2014 -0600
+++ b/hgext/purge.py	Fri Feb 14 03:06:44 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)