Re: D2938: grep: make grep search on working directory by default

2018-07-03 Thread Sangeet Kumar Mishra
Yeah On Tue, Jul 3, 2018 at 11:39 PM durin42 (Augie Fackler) < phabrica...@mercurial-scm.org> wrote: > durin42 added a comment. > > > It looks like this is obsoleted by https://phab.mercurial-scm.org/D3826? > > REPOSITORY > rHG Mercurial > > REVISION DETAIL >

D2938: grep: make grep search on working directory by default

2018-07-03 Thread durin42 (Augie Fackler)
durin42 added a comment. It looks like this is obsoleted by https://phab.mercurial-scm.org/D3826? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2938 To: sangeet259, #hg-reviewers Cc: durin42, martinvonz, av6, yuja, pulkit, mercurial-devel

Re: D2938: grep: make grep search on working directory by default

2018-06-12 Thread Yuya Nishihara
> @yuja I am adding an --unmodified flag to change to change the mode to > grep on the unmodified files as well. > What I am trying to do is :: > > def fns_generator(): > if --unmodified: > for f in ctx: > for f in ctx: > if

D2938: grep: make grep search on working directory by default

2018-06-12 Thread yuja (Yuya Nishihara)
yuja added a comment. > @yuja I am adding an --unmodified flag to change to change the mode to grep on the unmodified files as well. > What I am trying to do is :: > > def fns_generator(): > if --unmodified: > for f in ctx: > for f

D2938: grep: make grep search on working directory by default

2018-06-12 Thread sangeet259 (Sangeet Kumar Mishra)
sangeet259 added a comment. @martinvonz, thanks for the reviews, but @yuja has asked me to break this patch into three patches. So I guess this is not going to be merged anyway. Currently, I am trying to add a flag like `--all_files` or `--unmodified` which will enable one to grep all

D2938: grep: make grep search on working directory by default

2018-06-11 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments. INLINE COMMENTS > sangeet259 wrote in commands.py:2584 > I could have made the call by simply passing `''` instead of > `opts.get('rev')` but I chose this because I am planning to build upon this > to handle revisions as well. I agree with Pulkit: it's

D2938: grep: make grep search on working directory by default

2018-06-11 Thread sangeet259 (Sangeet Kumar Mishra)
sangeet259 added a comment. @yuja I am adding an --unmodified flag to change to change the mode to grep on the unmodified files as well. What I am trying to do is :: def fns_generator(): if --unmodified: for f in ctx: for f in ctx:

D2938: grep: make grep search on working directory by default

2018-06-06 Thread yuja (Yuya Nishihara)
yuja added a comment. > Hey @yuja > Can you explain why you did this ? > > > - slowpath = match.anypats() or (not match.always() and opts.get('removed')) +slowpath = True From my vague memory, I guess I would think that if we do `s/ctx.files()/ctx/` (which means

Re: D2938: grep: make grep search on working directory by default

2018-06-06 Thread Yuya Nishihara
> Hey @yuja > Can you explain why you did this ? > > > - slowpath = match.anypats() or (not match.always() and > opts.get('removed')) +slowpath = True From my vague memory, I guess I would think that if we do `s/ctx.files()/ctx/` (which means we're looking for revisions where files

D2938: grep: make grep search on working directory by default

2018-06-05 Thread sangeet259 (Sangeet Kumar Mishra)
sangeet259 added a comment. Hey @yuja Can you explain why you did this ? > - slowpath = match.anypats() or (not match.always() and opts.get('removed')) +slowpath = True REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2938 To: sangeet259,

D2938: grep: make grep search on working directory by default

2018-05-26 Thread sangeet259 (Sangeet Kumar Mishra)
sangeet259 added a comment. > Perhaps, we'll have to catch WdirUnsupported error to fall back to the filectx API. This seems a good idea. Trying it. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2938 To: sangeet259, #hg-reviewers Cc: av6, yuja, pulkit,

D2938: grep: make grep search on working directory by default

2018-05-25 Thread yuja (Yuya Nishihara)
yuja added a comment. > So I was working on it, but the way I tried to correct "wdir()" is by handling it as a special case, so introducing an "if" block again similar to this. > But you were asking to eliminate the if/else block altogether, I wonder if there is way ? IIRC, my

Re: D2938: grep: make grep search on working directory by default

2018-05-25 Thread Yuya Nishihara
> So I was working on it, but the way I tried to correct "wdir()" is by > handling it as a special case, so introducing an "if" block again similar to > this. > But you were asking to eliminate the if/else block altogether, I wonder if > there is way ? IIRC, my point was to avoid adding

D2938: grep: make grep search on working directory by default

2018-05-24 Thread sangeet259 (Sangeet Kumar Mishra)
sangeet259 added a comment. @yuja So I was working on it, but the way I tried to correct "wdir()" is by handling it as a special case, so introducing an "if" block again similar to this. But you were asking to eliminate the if/else block altogether, I wonder if there is way ?

D2938: grep: make grep search on working directory by default

2018-04-19 Thread yuja (Yuya Nishihara)
yuja added a comment. > What exactly do you mean by fixing 'grep -r wdir()' ? Make it return the same result as $ hg ci -m 'this was wdir()' $ hg grep -r . REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2938 To: sangeet259, #hg-reviewers Cc:

D2938: grep: make grep search on working directory by default

2018-04-17 Thread sangeet259 (Sangeet Kumar Mishra)
sangeet259 marked 2 inline comments as done. sangeet259 added a comment. @yuja > fix grep -r 'wdir()' What exactly do you mean by fixing 'grep -r wdir()' ? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2938 To: sangeet259, #hg-reviewers Cc: av6,

D2938: grep: make grep search on working directory by default

2018-03-26 Thread sangeet259 (Sangeet Kumar Mishra)
sangeet259 updated this revision to Diff 7289. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2938?vs=7280=7289 REVISION DETAIL https://phab.mercurial-scm.org/D2938 AFFECTED FILES mercurial/commands.py tests/test-grep.t CHANGE DETAILS diff --git

D2938: grep: make grep search on working directory by default

2018-03-25 Thread yuja (Yuya Nishihara)
yuja added inline comments. INLINE COMMENTS > yuja wrote in commands.py:2474 > > Shall I change that to returning wdirid? > > That isn't easy to answer because `wctx.filenode()` can return > another pseudo > hash (e.g. 000added) if `wctx._manifest` is preloaded. > > > highlight the

D2938: grep: make grep search on working directory by default

2018-03-25 Thread yuja (Yuya Nishihara)
yuja added a comment. In https://phab.mercurial-scm.org/D2938#47514, @sangeet259 wrote: > @yuja Can you please clarify this a bit more? > > > Perhaps we can start with adding an experimental option to grep files > > including unchanged ones?" This patch appears to do 3

D2938: grep: make grep search on working directory by default

2018-03-25 Thread sangeet259 (Sangeet Kumar Mishra)
sangeet259 added a comment. @yuja Can you please clarify this a bit more? > Perhaps we can start with adding an experimental option to grep files > including unchanged ones?" INLINE COMMENTS > yuja wrote in commands.py:2474 > Better to test if ctx is a workingctx (i.e. `ctx.rev() is

D2938: grep: make grep search on working directory by default

2018-03-25 Thread sangeet259 (Sangeet Kumar Mishra)
sangeet259 updated this revision to Diff 7280. sangeet259 marked 7 inline comments as done. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2938?vs=7267=7280 REVISION DETAIL https://phab.mercurial-scm.org/D2938 AFFECTED FILES mercurial/commands.py

D2938: grep: make grep search on working directory by default

2018-03-24 Thread av6 (Anton Shestakov)
av6 added inline comments. INLINE COMMENTS > commands.py:2485 > +fm.data(node=fm.hexfunc(scmutil.binnode(ctx))) > +if not bool(opts.get('all')) and not bool(opts.get('rev')): > +cols = [ This line looks identical to the one later on, with Pulkit's comment

D2938: grep: make grep search on working directory by default

2018-03-24 Thread yuja (Yuya Nishihara)
yuja added inline comments. INLINE COMMENTS > commands.py:2474 > +return util.binary(flog.read(ctx.filenode(fn))) > +except AttributeError: > +return util.binary(ctx.filectx(fn).data()) Better to test if ctx is a workingctx (i.e. `ctx.rev() is None`).

D2938: grep: make grep search on working directory by default

2018-03-24 Thread yuja (Yuya Nishihara)
yuja added a comment. Perhaps we can start with adding an experimental option to grep files including unchanged ones? IIUC, the new default behavior is something like `hg grep -r "wdir()" --all-files`, which is basically `s/ctx.files()/ctx/`. (needless to say `--all-files` is a bad

D2938: grep: make grep search on working directory by default

2018-03-24 Thread sangeet259 (Sangeet Kumar Mishra)
sangeet259 updated this revision to Diff 7267. sangeet259 edited the summary of this revision. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2938?vs=7266=7267 REVISION DETAIL https://phab.mercurial-scm.org/D2938 AFFECTED FILES mercurial/commands.py

D2938: grep: make grep search on working directory by default

2018-03-24 Thread pulkit (Pulkit Goyal)
pulkit added a comment. No need to add Edit1, Edit2 in commit message. If something changes from one version to another that deserves mention, include that in commit message as normal. INLINE COMMENTS > commands.py:2583 > +# when nothing is passed in -r or --all > +if not

D2938: grep: make grep search on working directory by default

2018-03-24 Thread sangeet259 (Sangeet Kumar Mishra)
sangeet259 updated this revision to Diff 7266. sangeet259 edited the summary of this revision. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2938?vs=7262=7266 REVISION DETAIL https://phab.mercurial-scm.org/D2938 AFFECTED FILES mercurial/commands.py

D2938: grep: make grep search on working directory by default

2018-03-23 Thread sangeet259 (Sangeet Kumar Mishra)
sangeet259 updated this revision to Diff 7262. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2938?vs=7261=7262 REVISION DETAIL https://phab.mercurial-scm.org/D2938 AFFECTED FILES mercurial/commands.py tests/test-grep.t CHANGE DETAILS diff --git

D2938: grep: make grep search on working directory by default

2018-03-23 Thread sangeet259 (Sangeet Kumar Mishra)
sangeet259 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The earlier behaviour of grep was quite counter intuitive as it searches history by default. It throws up matches from files which have been deleted and