203 files = l[3:] |
203 files = l[3:] |
204 return (manifest, user, (time, timezone), files, desc, extra) |
204 return (manifest, user, (time, timezone), files, desc, extra) |
205 |
205 |
206 def add(self, manifest, files, desc, transaction, p1, p2, |
206 def add(self, manifest, files, desc, transaction, p1, p2, |
207 user, date=None, extra=None): |
207 user, date=None, extra=None): |
|
208 # Convert to UTF-8 encoded bytestrings as the very first |
|
209 # thing: calling any method on a localstr object will turn it |
|
210 # into a str object and the cached UTF-8 string is thus lost. |
|
211 user, desc = encoding.fromlocal(user), encoding.fromlocal(desc) |
|
212 |
208 user = user.strip() |
213 user = user.strip() |
209 # An empty username or a username with a "\n" will make the |
214 # An empty username or a username with a "\n" will make the |
210 # revision text contain two "\n\n" sequences -> corrupt |
215 # revision text contain two "\n\n" sequences -> corrupt |
211 # repository since read cannot unpack the revision. |
216 # repository since read cannot unpack the revision. |
212 if not user: |
217 if not user: |
215 raise error.RevlogError(_("username %s contains a newline") |
220 raise error.RevlogError(_("username %s contains a newline") |
216 % repr(user)) |
221 % repr(user)) |
217 |
222 |
218 # strip trailing whitespace and leading and trailing empty lines |
223 # strip trailing whitespace and leading and trailing empty lines |
219 desc = '\n'.join([l.rstrip() for l in desc.splitlines()]).strip('\n') |
224 desc = '\n'.join([l.rstrip() for l in desc.splitlines()]).strip('\n') |
220 |
|
221 user, desc = encoding.fromlocal(user), encoding.fromlocal(desc) |
|
222 |
225 |
223 if date: |
226 if date: |
224 parseddate = "%d %d" % util.parsedate(date) |
227 parseddate = "%d %d" % util.parsedate(date) |
225 else: |
228 else: |
226 parseddate = "%d %d" % util.makedate() |
229 parseddate = "%d %d" % util.makedate() |