.bzrignore should support exclusions
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bazaar |
Fix Released
|
Medium
|
John Whitley |
Bug Description
There are compelling cases for supporting ignore exclusions in the .bzrignore format, including versioning of "live" directories such as the rcfiles within a user's home directory, or system configuration files (e.g. files under /etc). Exclusions also improve utility of the ignore files for cases where a mix of auto-generated (and ignored) files coexist with hand-maintained files, such as generated vs. hand-coded HTML files.
I propose to mimic git's syntax for ignore exclusions, which is that prepending an exclamation point (!) to a line in .bzrignore explicitly indicates that matching files be considered trackable.
Example, a .bzrignore file for versioning rcfiles:
----------------
# Ignore everything except files and directories covered below.
*
# We're using zsh, so track all files and direcories starting with '.z'.
# This covers the standards such as .zshrc, .zaliases, etc. and
# files (.zglobalfns) and dirs (.zfunctions/) custom to this project
.z**
# Also version ~/local
~/local
~/local/**
----------------
I haven't investigated the current ignore semantics in bzrlib in detail -- the above example might change a bit depending on the particulars. For example, are both the "~/local" and "~/local/**" lines necessary for a simple implementation of exclusions? Should they be (or not)?
Related branches
- Martin Pool: Approve
- John A Meinel: Approve
-
Diff: 270 lines (+112/-5)8 files modifiedNEWS (+7/-0)
bzrlib/builtins.py (+19/-1)
bzrlib/globbing.py (+35/-2)
bzrlib/help_topics/en/patterns.txt (+3/-0)
bzrlib/tests/per_workingtree/test_is_ignored.py (+15/-0)
bzrlib/tests/test_globbing.py (+25/-0)
bzrlib/tests/test_ignores.py (+4/-0)
bzrlib/workingtree.py (+4/-2)
Changed in bzr: | |
status: | New → Confirmed |
importance: | Undecided → Medium |
Changed in bzr: | |
assignee: | nobody → John Whitley (whitley) |
milestone: | none → 2.1.0rc1 |
status: | Confirmed → Fix Released |
I have an initial implementation of this with tests at lp:~whitley/bzr/ignore-exclusion. I need to update the help, one more test case that just came to mind, and think more about edge-cases and/or unintended side effects.
Description: The above branch extends .bzrignore syntax to support ignore exclusions. These are regular ignore patterns prefixed with an exclamation point (!). These patterns take precedence over other ignore patterns and cause matched filenames to not be ignored.
I expect to add the final polish to the patch and formally propose a merge in the next day or two.