Show More
@@ -236,6 +236,12 ui:: | |||||
236 | Print debugging information. True or False. Default is False. |
|
236 | Print debugging information. True or False. Default is False. | |
237 | editor;; |
|
237 | editor;; | |
238 | The editor to use during a commit. Default is $EDITOR or "vi". |
|
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 | interactive;; |
|
245 | interactive;; | |
240 | Allow to prompt the user. True or False. Default is True. |
|
246 | Allow to prompt the user. True or False. Default is True. | |
241 | logtemplate;; |
|
247 | logtemplate;; |
@@ -34,7 +34,11 class dirstate(object): | |||||
34 | return cwd[len(self.root) + 1:] |
|
34 | return cwd[len(self.root) + 1:] | |
35 |
|
35 | |||
36 | def hgignore(self): |
|
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 | trailing white space is dropped. |
|
43 | trailing white space is dropped. | |
40 | the escape character is backslash. |
|
44 | the escape character is backslash. | |
@@ -58,9 +62,12 class dirstate(object): | |||||
58 | elif line[i] == '#': break |
|
62 | elif line[i] == '#': break | |
59 | line = line[:i].rstrip() |
|
63 | line = line[:i].rstrip() | |
60 | if line: yield line |
|
64 | if line: yield line | |
|
65 | files = [self.wjoin('.hgignore')] | |||
|
66 | files.extend(self.ui.hgignorefiles()) | |||
61 | pats = [] |
|
67 | pats = [] | |
|
68 | for f in files: | |||
62 | try: |
|
69 | try: | |
63 |
fp = open( |
|
70 | fp = open(f) | |
64 | syntax = 'relre:' |
|
71 | syntax = 'relre:' | |
65 | for line in parselines(fp): |
|
72 | for line in parselines(fp): | |
66 | if line.startswith('syntax:'): |
|
73 | if line.startswith('syntax:'): | |
@@ -68,8 +75,8 class dirstate(object): | |||||
68 | try: |
|
75 | try: | |
69 | syntax = syntaxes[s] |
|
76 | syntax = syntaxes[s] | |
70 | except KeyError: |
|
77 | except KeyError: | |
71 |
self.ui.warn(_(" |
|
78 | self.ui.warn(_("%s: ignoring invalid " | |
72 | "syntax '%s'\n") % s) |
|
79 | "syntax '%s'\n") % (f, s)) | |
73 | continue |
|
80 | continue | |
74 | pat = syntax + line |
|
81 | pat = syntax + line | |
75 | for s in syntaxes.values(): |
|
82 | for s in syntaxes.values(): | |
@@ -81,13 +88,18 class dirstate(object): | |||||
81 | return pats |
|
88 | return pats | |
82 |
|
89 | |||
83 | def ignore(self, fn): |
|
90 | def ignore(self, fn): | |
84 |
'''default match function used by dirstate and |
|
91 | '''default match function used by dirstate and | |
85 |
this honours the .hgignore file |
|
92 | localrepository. this honours the repository .hgignore file | |
|
93 | and any other files specified in the [ui] section of .hgrc.''' | |||
86 | if self.blockignore: |
|
94 | if self.blockignore: | |
87 | return False |
|
95 | return False | |
88 | if not self.ignorefunc: |
|
96 | if not self.ignorefunc: | |
89 | ignore = self.hgignore() |
|
97 | ignore = self.hgignore() | |
90 | if ignore: |
|
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 | files, self.ignorefunc, anypats = util.matcher(self.root, |
|
103 | files, self.ignorefunc, anypats = util.matcher(self.root, | |
92 | inc=ignore, |
|
104 | inc=ignore, | |
93 | src='.hgignore') |
|
105 | src='.hgignore') |
@@ -123,6 +123,15 class ui(object): | |||||
123 | def extensions(self): |
|
123 | def extensions(self): | |
124 | return self.configitems("extensions") |
|
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 | def diffopts(self): |
|
135 | def diffopts(self): | |
127 | if self.diffcache: |
|
136 | if self.diffcache: | |
128 | return self.diffcache |
|
137 | return self.diffcache |
General Comments 0
You need to be logged in to leave comments.
Login now