.bzrignore should support exclusions

Bug #428031 reported by John Whitley
14
This bug affects 3 people
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 (mbp)
Changed in bzr:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
John Whitley (whitley) wrote :

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.

Revision history for this message
John Whitley (whitley) wrote :

NOTE: I just now realized that in the bug description, the leading exclamation points for the exclusion patterns are missing. I'm not sure whether this was an oversight on my part or a text processing issue, but I wanted to call it out for clarity.

John A Meinel (jameinel)
Changed in bzr:
assignee: nobody → John Whitley (whitley)
milestone: none → 2.1.0rc1
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.