Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide an "exclude" option for the b2 sync command #150

Closed
segphault opened this issue May 7, 2016 · 17 comments
Closed

Provide an "exclude" option for the b2 sync command #150

segphault opened this issue May 7, 2016 · 17 comments

Comments

@segphault
Copy link
Contributor

It'd be really useful to be able to exclude paths that match a certain pattern from synchronization. For example, if I'm synchronizing a bunch of node.js projects, I might want to have b2 sync ignore all the node_modules folders.

@bwbeach
Copy link
Contributor

bwbeach commented May 7, 2016

Good idea.

Do you want the excluded things to be wildcards? Regexp or glob? Match the entire path, or just the file name?

I assume that if a folder is excluded, everything under it should be excluded, too.

@segphault
Copy link
Contributor Author

For the case that I care about personally, I want to be able to match just the file name rather than the whole path, but I could see the latter also being useful in some situations. I'd like to be able to do something like --exclude "node_modules" and have it exclude directories that match that name everywhere they appear in the hierarchy.

Wildcards would also be great, I think either glob or regex would work well. And yep, it'd also skip the contents of excluded folders. Thanks!

@segphault
Copy link
Contributor Author

I decided to take a crack at implementing this myself. Given the way that the sync feature builds its file list, matching against the full path ended up being the most practical and least intrusive approach. I also decided on using a regex for the match.

@sund
Copy link

sund commented May 8, 2016

I would also like to see rsync-style exclusion and inclusion, i.e. from the rsync help:

--exclude=PATTERN     exclude files matching PATTERN

--exclude-from=FILE     read exclude patterns from FILE

--include=PATTERN     don't exclude files matching PATTERN

--include-from=FILE     read include patterns from FILE

Just my thoughts.

@ppolewicz
Copy link
Collaborator

@sund this seems like a very small change after #153 is merged. Would you like to implement the options you mentioned?

@TJC
Copy link
Contributor

TJC commented Aug 8, 2016

Just wanted to say -- I think you should try and implement the same exclude patterns as rsync; they've become reasonably well-understood by many people, and supported by third-party apps.

@ppolewicz
Copy link
Collaborator

@TJC @sund @segphault do you still need this?

@simongreen-net
Copy link

I would like to see this option.

@ppolewicz
Copy link
Collaborator

@simongreen-net okay. Would you like to implement it?

We encourage outside contributors to perform changes on our codebase. Many such changes have been merged already. In order to make it easier to contribute, core developers of this project:

  • provide guidance (through the issue reporting system)
  • provide tool assisted code review (through the Pull Request system)
  • maintain a set of integration tests (run with a production cloud)
  • maintain a set of (well over a hundred) unit tests
  • automatically run unit tests on 14 versions of python (including osx, Jython and pypy)
  • format the code automatically using yapf
  • use static code analysis to find subtle/potential issues with maintainability
  • maintain other Continous Integration tools (coverage tracker)

this particular change is rather easy to implement.

@simongreen-net
Copy link

Sorry, my Python skills aren't at a level where I would be able to write a patch.

@sund
Copy link

sund commented Sep 18, 2016

I would also like this. But, like, @simongreen-net my python-fu depends on google more than it should.

@ppolewicz ppolewicz self-assigned this Sep 18, 2016
@ppolewicz
Copy link
Collaborator

ok, I have somebody working on this. Assigning myself as a placeholder.

neube3 added a commit to neube3/B2_Command_Line_Tool that referenced this issue Sep 18, 2016
@TJC
Copy link
Contributor

TJC commented Sep 19, 2016

@ppolewicz -- Yes, I'd still like to see this feature.. but my Python skills aren't really up there, sorry.

@therecluse26
Copy link

Just my two cents... I think that instead of (or inaddition to) having a regex-based ignore function it'd be way more helpful to enable a sort of "ignore" file with a list of all the excluded sync directories, much like the way that the .gitignore file works.

@dougwollison
Copy link

@therecluse26 agreed. I'm personally very fond of the --filter=[file] option in rsync; I can have a nice include/exclude ruleset so that I can sync just what I need.

@therecluse26
Copy link

Any updates on this?

@ppolewicz
Copy link
Collaborator

#244 has been merged

as for --exclude-from=FILE and --include-from=FILE, maybe one day someone will contribute it, when doing so please reference this issue. For now, lets close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants