48 from mercurial.node import ( |
48 from mercurial.node import ( |
49 short, |
49 short, |
50 ) |
50 ) |
51 from mercurial import ( |
51 from mercurial import ( |
52 registrar, |
52 registrar, |
53 util, |
53 ) |
|
54 from mercurial.utils import ( |
|
55 stringutil, |
54 ) |
56 ) |
55 |
57 |
56 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
58 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
57 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
59 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
58 # be specifying the version(s) of Mercurial they are tested with, or |
60 # be specifying the version(s) of Mercurial they are tested with, or |
98 |
100 |
99 def macdumbencode(s, cmd): |
101 def macdumbencode(s, cmd): |
100 return s.replace('\r', '\n') |
102 return s.replace('\r', '\n') |
101 |
103 |
102 def cleverdecode(s, cmd, **kwargs): |
104 def cleverdecode(s, cmd, **kwargs): |
103 if not util.binary(s): |
105 if not stringutil.binary(s): |
104 return dumbdecode(s, cmd, **kwargs) |
106 return dumbdecode(s, cmd, **kwargs) |
105 return s |
107 return s |
106 |
108 |
107 def cleverencode(s, cmd): |
109 def cleverencode(s, cmd): |
108 if not util.binary(s): |
110 if not stringutil.binary(s): |
109 return dumbencode(s, cmd) |
111 return dumbencode(s, cmd) |
110 return s |
112 return s |
111 |
113 |
112 def macdecode(s, cmd, **kwargs): |
114 def macdecode(s, cmd, **kwargs): |
113 if not util.binary(s): |
115 if not stringutil.binary(s): |
114 return macdumbdecode(s, cmd, **kwargs) |
116 return macdumbdecode(s, cmd, **kwargs) |
115 return s |
117 return s |
116 |
118 |
117 def macencode(s, cmd): |
119 def macencode(s, cmd): |
118 if not util.binary(s): |
120 if not stringutil.binary(s): |
119 return macdumbencode(s, cmd) |
121 return macdumbencode(s, cmd) |
120 return s |
122 return s |
121 |
123 |
122 _filters = { |
124 _filters = { |
123 'dumbdecode:': dumbdecode, |
125 'dumbdecode:': dumbdecode, |
144 for f in c.files(): |
146 for f in c.files(): |
145 if f in seen or f not in tip or f not in c: |
147 if f in seen or f not in tip or f not in c: |
146 continue |
148 continue |
147 seen.add(f) |
149 seen.add(f) |
148 data = c[f].data() |
150 data = c[f].data() |
149 if not util.binary(data) and newline in data: |
151 if not stringutil.binary(data) and newline in data: |
150 if not halt: |
152 if not halt: |
151 ui.warn(_('attempt to commit or push text file(s) ' |
153 ui.warn(_('attempt to commit or push text file(s) ' |
152 'using %s line endings\n') % |
154 'using %s line endings\n') % |
153 newlinestr[newline]) |
155 newlinestr[newline]) |
154 ui.warn(_('in %s: %s\n') % (short(c.node()), f)) |
156 ui.warn(_('in %s: %s\n') % (short(c.node()), f)) |