Show More
@@ -236,6 +236,12 b' ui::' | |||
|
236 | 236 | Print debugging information. True or False. Default is False. |
|
237 | 237 | editor;; |
|
238 | 238 | The editor to use during a commit. Default is $EDITOR or "vi". |
|
239 | ignore;; | |
|
240 | A file to read per-user ignore patterns from. This file should be in | |
|
241 | the same format as a repository-wide .hgignore file. This option | |
|
242 | supports hook syntax, so if you want to specify multiple ignore | |
|
243 | files, you can do so by setting something like | |
|
244 | "ignore.other = ~/.hgignore2". | |
|
239 | 245 | interactive;; |
|
240 | 246 | Allow to prompt the user. True or False. Default is True. |
|
241 | 247 | logtemplate;; |
@@ -34,7 +34,11 b' class dirstate(object):' | |||
|
34 | 34 | return cwd[len(self.root) + 1:] |
|
35 | 35 | |
|
36 | 36 | def hgignore(self): |
|
37 | '''return the contents of .hgignore as a list of patterns. | |
|
37 | '''return the contents of .hgignore files as a list of patterns. | |
|
38 | ||
|
39 | the files parsed for patterns include: | |
|
40 | .hgignore in the repository root | |
|
41 | any additional files specified in the [ui] section of ~/.hgrc | |
|
38 | 42 | |
|
39 | 43 | trailing white space is dropped. |
|
40 | 44 | the escape character is backslash. |
@@ -58,36 +62,44 b' class dirstate(object):' | |||
|
58 | 62 | elif line[i] == '#': break |
|
59 | 63 | line = line[:i].rstrip() |
|
60 | 64 | if line: yield line |
|
65 | files = [self.wjoin('.hgignore')] | |
|
66 | files.extend(self.ui.hgignorefiles()) | |
|
61 | 67 | pats = [] |
|
62 | try: | |
|
63 | fp = open(self.wjoin('.hgignore')) | |
|
64 | syntax = 'relre:' | |
|
65 | for line in parselines(fp): | |
|
66 |
|
|
|
67 |
|
|
|
68 |
|
|
|
69 |
|
|
|
70 | except KeyError: | |
|
71 | self.ui.warn(_(".hgignore: ignoring invalid " | |
|
72 | "syntax '%s'\n") % s) | |
|
73 | continue | |
|
74 |
|
|
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
|
78 |
|
|
|
79 | pats.append(pat) | |
|
80 | except IOError: pass | |
|
68 | for f in files: | |
|
69 | try: | |
|
70 | fp = open(f) | |
|
71 | syntax = 'relre:' | |
|
72 | for line in parselines(fp): | |
|
73 | if line.startswith('syntax:'): | |
|
74 | s = line[7:].strip() | |
|
75 | try: | |
|
76 | syntax = syntaxes[s] | |
|
77 | except KeyError: | |
|
78 | self.ui.warn(_("%s: ignoring invalid " | |
|
79 | "syntax '%s'\n") % (f, s)) | |
|
80 | continue | |
|
81 | pat = syntax + line | |
|
82 | for s in syntaxes.values(): | |
|
83 | if line.startswith(s): | |
|
84 | pat = line | |
|
85 | break | |
|
86 | pats.append(pat) | |
|
87 | except IOError: pass | |
|
81 | 88 | return pats |
|
82 | 89 | |
|
83 | 90 | def ignore(self, fn): |
|
84 |
'''default match function used by dirstate and |
|
|
85 |
this honours the .hgignore file |
|
|
91 | '''default match function used by dirstate and | |
|
92 | localrepository. this honours the repository .hgignore file | |
|
93 | and any other files specified in the [ui] section of .hgrc.''' | |
|
86 | 94 | if self.blockignore: |
|
87 | 95 | return False |
|
88 | 96 | if not self.ignorefunc: |
|
89 | 97 | ignore = self.hgignore() |
|
90 | 98 | if ignore: |
|
99 | # FIXME: if there are errors in patterns, matcher will | |
|
100 | # print out an error containing src ('.hgignore'); | |
|
101 | # really, we want the original source file to be | |
|
102 | # printed instead. | |
|
91 | 103 | files, self.ignorefunc, anypats = util.matcher(self.root, |
|
92 | 104 | inc=ignore, |
|
93 | 105 | src='.hgignore') |
@@ -123,6 +123,15 b' class ui(object):' | |||
|
123 | 123 | def extensions(self): |
|
124 | 124 | return self.configitems("extensions") |
|
125 | 125 | |
|
126 | def hgignorefiles(self): | |
|
127 | result = [] | |
|
128 | cfgitems = self.configitems("ui") | |
|
129 | for key, value in cfgitems: | |
|
130 | if key == 'ignore' or key.startswith('ignore.'): | |
|
131 | path = os.path.expanduser(value) | |
|
132 | result.append(path) | |
|
133 | return result | |
|
134 | ||
|
126 | 135 | def diffopts(self): |
|
127 | 136 | if self.diffcache: |
|
128 | 137 | return self.diffcache |
General Comments 0
You need to be logged in to leave comments.
Login now