victor-torres / atom-hg

Mercurial support for Atom text editor. Works on Linux, Mac OS X and Windows.
https://atom.io/packages/atom-hg
MIT License
27 stars 5 forks source link

Ignoring directories #33

Open TomKemperNL opened 8 years ago

TomKemperNL commented 8 years ago

Currently directories with only ignored files are showed as empty directories. I'd prefer to hide them (just like the git-repo does).

Unfortunately, unlike Git, Mercurial doesn't track directory information, so where Git Status --ignored nicely shows 'the best stuff to hide', Hg Status -i will gladly show each and every file of your node_modules folder as ignored.

The simplest option would be to unify our status cache and mark directories:

The other option dovetails with the problem that hg stat -i is sloooow. We could try to just parse .hgignore and replicate the mercurial ignore-rules. I think 90% of that will be easy, and the remaining 10% will be a hellish collection of edge-cases. Maybe porting the ignore unit-tests from mercurial could work...

Unless people feel deeply about option 2, I'll get started on option 1, since we'll be able to reuse the resulting unit-tests for option 2. I definitely think we'll need to do option 2 someday, but I'd rather add the functionality first and focus on performance later.

victor-torres commented 8 years ago

Mercurial should be responsible for that. But you're right. There seems to be no support for an hg status -i with ignored directories.

I also thought about parsing the .hgignore file but there may be extra files for submodules. And Mercurial supports multiple syntaxes including regexp and glob.

TomKemperNL commented 7 years ago

Just a quick update. I'm still hacking away at this on my fork (at about half an hour a week, so it's going to take a while...).

It currently works (as a nice side-effect of using the status-bitmasks at the directory level)... however it's way too slow to be practical.

(https://github.com/TomKemperNL/atom-hg/tree/ignored_dirs)

TomKemperNL commented 7 years ago

I'm kinda drawing a blank on improving performance while shelling out to hg

The other alternative, parsing .hgignore ourselves is also looking dicey. I've been looking at the Mercurial sourcecode and there's nearly 800 lines of python code concerned with it. (having zero python experience means this is a rather slow process).

So, working on it, no clue yet how to solve it.

gabefinch commented 7 years ago

I really love the plugin. Related to this bug it seems for me that atom-hg doesn't pay attention to the atom setting 'Exclude VCS Ignored Paths'. In other words .hgingnore files are hidden for me regardless of whether 'Exclude VCS Ignored Paths' is checked or not. My case is wanting to get all the benefits of the plugin, but I don't want ignored files hidden. I'm on Windows BTW.

victor-torres commented 7 years ago

I really love the plugin.

Thanks, @gabefinch! I really appreciate our plugin is being helpful :)

Related to this bug it seems for me that atom-hg doesn't pay attention to the atom setting 'Exclude VCS Ignored Paths'. In other words .hgingnore files are hidden for me regardless of whether 'Exclude VCS Ignored Paths' is checked or not.

If I’m right, I think we can create another ticket for this. In your case, you want the ignored files to be shown.

My case is wanting to get all the benefits of the plugin, but I don't want ignored files hidden. I'm on Windows BTW.

Yes. We can create another ticket for that (#44).

In the case of this ticket, the problem is that when we are hiding the ignored files, if a directory only contains ignored files (or it is also ignored in .hgignore) Atom still displays it as a regular directory. This is a limitation by the Mercurial executable itself, and @TomKemperNL and I have been thinking about a way to solve this problem on the plugin side, but it seems difficult until now and almost not possible in a regular way.