[RFC, MAYBE-MERGE] DEFAULT_IGNORE as an API (Re: Problem with bzr without default ignore list.)

Adeodato Simó dato at net.com.org.es
Tue Jul 11 00:28:58 BST 2006


* Matthieu Moy [Mon, 10 Jul 2006 17:03:57 +0200]:

> DVC is one example, but "bzr shelve" has the same problem, and many
> other bzr-related tools will also want to store hidden or temporary
> files in the tree.

[...]

> Any opinion?

I've been meaning to write this mail since the DEFAULT_IGNORE change was
introduced, because there were a couple opinions (or concerns) that I
really wanted to share.

The first and more important one (and the one related to Matthieu's
mail), is the concern that the change "remove default ignores" has been
implemented in a way that breaks the (at least defacto) API that
DEFAULT_IGNORE was. TTBOMK, DEFAULT_IGNORE was the only way that apps
using bzrlib had if they wanted add entries to the ignore list without
resorting to munging .bzrignore. Which can be very desirable, think eg.
plugins like shelf, or migration tools like tailor.

I'd ask that, please, DEFAULT_IGNORE gets redefined as an empty list,
and get_ignore_list() in workingtree.py goes back to using it. The old
default list can be shipped in eg. OLD_DEFAULT_IGNORE, and `ignore
--old-default-rules` can use that. (This should be trivial, something
along the lines of the attached patch.)

There were also other ideas about keeping the O_D_I list up to date with
new additions, and maybe have some keyword in .bzrignore to reference it. 
But since this is way more irrelevant, I won't advocate for it in full
this time, and let you concentrate in the first issue explained above.

Thanks,

-- 
Adeodato Simó                                     dato at net.com.org.es
Debian Developer                                  adeodato at debian.org
 
HS boy #1: Okay, who's Pavlov?
HS boy #2: I don't know, it doesn't ring a bell.
                -- http://www.overheardinnewyork.com/archives/003016.html
-------------- next part --------------
# Bazaar revision bundle v0.8
#
# message:
#   Keep using DEFAULT_IGNORE in WorkingTree.get_ignore_list(), to allow
#   third-party code to add ignore entries. Move the old ignore list to
#   OLD_DEFAULT_IGNORE, and make `ignore --old-default-rules` use that.
#   
# committer: Adeodato Simó <dato at net.com.org.es>
# date: Tue 2006-07-11 01:26:02.938709021 +0200

=== modified file bzrlib/__init__.py
--- bzrlib/__init__.py
+++ bzrlib/__init__.py
@@ -18,7 +18,7 @@
 
 
 # please keep these sorted (in C locale order) to aid merging
-DEFAULT_IGNORE = [
+OLD_DEFAULT_IGNORE = [
                   '#*#',
                   '*$',
                   '*,v',
@@ -77,6 +77,8 @@
                   './.python-eggs',
                   ]
 
+DEFAULT_IGNORE = []
+
 IGNORE_FILENAME = ".bzrignore"
 
 import os

=== modified file bzrlib/builtins.py
--- bzrlib/builtins.py
+++ bzrlib/builtins.py
@@ -1467,7 +1467,7 @@
         from bzrlib.atomicfile import AtomicFile
         if old_default_rules is not None:
             # dump the rules and exit
-            for pattern in bzrlib.DEFAULT_IGNORE:
+            for pattern in bzrlib.OLD_DEFAULT_IGNORE:
                 print pattern
             return
         if name_pattern is None:

=== modified file bzrlib/workingtree.py
--- bzrlib/workingtree.py
+++ bzrlib/workingtree.py
@@ -1079,7 +1079,7 @@
         if hasattr(self, '_ignorelist'):
             return self._ignorelist
 
-        l = []
+        l = bzrlib.DEFAULT_IGNORE[:]
         if self.has_filename(bzrlib.IGNORE_FILENAME):
             f = self.get_file_byname(bzrlib.IGNORE_FILENAME)
             l.extend([line.rstrip("\n\r").decode('utf-8') 

# revision id: dato at net.com.org.es-20060710232602-c35c9657602bc487
# sha1: 559c3d4ed6e5c93c8e67c55279c1c457cbaa710a
# inventory sha1: 5ffaddfa24124c59e4b60cf2f0baf51237f70fe5
# parent ids:
#   pqm at pqm.ubuntu.com-20060710203006-17445a0e4b07b070
# base id: pqm at pqm.ubuntu.com-20060710203006-17445a0e4b07b070
# properties:
#   branch-nick: bzr.dev.dato



More information about the bazaar mailing list