equal
deleted
inserted
replaced
5 # This software may be used and distributed according to the terms |
5 # This software may be used and distributed according to the terms |
6 # of the GNU General Public License, incorporated herein by reference. |
6 # of the GNU General Public License, incorporated herein by reference. |
7 |
7 |
8 from node import bin, hex, nullid |
8 from node import bin, hex, nullid |
9 from i18n import _ |
9 from i18n import _ |
10 import util, error, revlog |
10 import util, error, revlog, encoding |
11 |
11 |
12 def _string_escape(text): |
12 def _string_escape(text): |
13 """ |
13 """ |
14 >>> d = {'nl': chr(10), 'bs': chr(92), 'cr': chr(13), 'nul': chr(0)} |
14 >>> d = {'nl': chr(10), 'bs': chr(92), 'cr': chr(13), 'nul': chr(0)} |
15 >>> s = "ab%(nl)scd%(bs)s%(bs)sn%(nul)sab%(cr)scd%(bs)s%(nl)s" % d |
15 >>> s = "ab%(nl)scd%(bs)s%(bs)sn%(nul)sab%(cr)scd%(bs)s%(nl)s" % d |
173 """ |
173 """ |
174 text = self.revision(node) |
174 text = self.revision(node) |
175 if not text: |
175 if not text: |
176 return (nullid, "", (0, 0), [], "", {'branch': 'default'}) |
176 return (nullid, "", (0, 0), [], "", {'branch': 'default'}) |
177 last = text.index("\n\n") |
177 last = text.index("\n\n") |
178 desc = util.tolocal(text[last + 2:]) |
178 desc = encoding.tolocal(text[last + 2:]) |
179 l = text[:last].split('\n') |
179 l = text[:last].split('\n') |
180 manifest = bin(l[0]) |
180 manifest = bin(l[0]) |
181 user = util.tolocal(l[1]) |
181 user = encoding.tolocal(l[1]) |
182 |
182 |
183 extra_data = l[2].split(' ', 2) |
183 extra_data = l[2].split(' ', 2) |
184 if len(extra_data) != 3: |
184 if len(extra_data) != 3: |
185 time = float(extra_data.pop(0)) |
185 time = float(extra_data.pop(0)) |
186 try: |
186 try: |
203 |
203 |
204 user = user.strip() |
204 user = user.strip() |
205 if "\n" in user: |
205 if "\n" in user: |
206 raise error.RevlogError(_("username %s contains a newline") |
206 raise error.RevlogError(_("username %s contains a newline") |
207 % repr(user)) |
207 % repr(user)) |
208 user, desc = util.fromlocal(user), util.fromlocal(desc) |
208 user, desc = encoding.fromlocal(user), encoding.fromlocal(desc) |
209 |
209 |
210 if date: |
210 if date: |
211 parseddate = "%d %d" % util.parsedate(date) |
211 parseddate = "%d %d" % util.parsedate(date) |
212 else: |
212 else: |
213 parseddate = "%d %d" % util.makedate() |
213 parseddate = "%d %d" % util.makedate() |