Changeset 1016 in tailor
- Timestamp:
- 11/19/05 16:08:58 (8 years ago)
- Hash name:
- 20051119150858-7a6fb-ef43cb57dcf40ce1a126b2d340e464d332ca57f2
- Location:
- vcpx
- Files:
-
- 12 edited
-
cvsps.py (modified) (1 diff)
-
darcs.py (modified) (1 diff)
-
svn.py (modified) (3 diffs)
-
shwrap.py (modified) (2 diffs)
-
tailor.py (modified) (3 diffs)
-
monotone.py (modified) (1 diff)
-
cdv.py (modified) (1 diff)
-
hg.py (modified) (2 diffs)
-
arx.py (modified) (1 diff)
-
cg.py (modified) (4 diffs)
-
git.py (modified) (3 diffs)
-
hglib.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
vcpx/cvsps.py
r1007 r1016 524 524 525 525 from shwrap import ReopenableNamedTemporaryFile 526 from locale import getpreferredencoding 527 528 encoding = ExternalCommand.FORCE_ENCODING or getpreferredencoding() 526 527 encode = self.repository.encode 529 528 530 529 logmessage = [] 531 530 if patchname: 532 logmessage.append(patchname .encode(encoding))531 logmessage.append(patchname) 533 532 if changelog: 534 logmessage.append(changelog .encode(encoding))533 logmessage.append(changelog) 535 534 logmessage.append('') 536 logmessage.append('Original author: %s' % author .encode(encoding))535 logmessage.append('Original author: %s' % author) 537 536 logmessage.append('Date: %s' % date) 538 537 539 538 rontf = ReopenableNamedTemporaryFile('cvs', 'tailor') 540 539 log = open(rontf.name, "w") 541 log.write( '\n'.join(logmessage))540 log.write(encode('\n'.join(logmessage))) 542 541 log.close() 543 542 -
vcpx/darcs.py
r1010 r1016 455 455 456 456 record = ExternalCommand(cwd=self.basedir, command=cmd) 457 record.execute(input= '\n'.join(logmessage))457 record.execute(input=self.repository.encode('\n'.join(logmessage))) 458 458 459 459 if record.exit_status: -
vcpx/svn.py
r1007 r1016 409 409 """ 410 410 411 from locale import getpreferredencoding 412 413 encoding = ExternalCommand.FORCE_ENCODING or getpreferredencoding() 411 encode = self.repository.encode 414 412 415 413 logmessage = [] 416 414 if patchname: 417 logmessage.append(patchname .encode(encoding))415 logmessage.append(patchname) 418 416 if changelog: 419 logmessage.append(changelog .encode(encoding))417 logmessage.append(changelog) 420 418 421 419 # If we cannot use propset, fall back to old behaviour of … … 424 422 if not self.USE_PROPSET: 425 423 logmessage.append('') 426 logmessage.append('Original author: %s' % author.encode(encoding))424 logmessage.append('Original author: %s' % encode(author)) 427 425 logmessage.append('Date: %s' % date) 428 426 429 427 rontf = ReopenableNamedTemporaryFile('svn', 'tailor') 430 428 log = open(rontf.name, "w") 431 log.write( '\n'.join(logmessage))429 log.write(encode('\n'.join(logmessage))) 432 430 log.close() 433 431 … … 472 470 473 471 propset.execute(date.isoformat()+".000000Z", propname='svn:date') 474 propset.execute( author.encode(encoding), propname='svn:author')472 propset.execute(encode(author), propname='svn:author') 475 473 476 474 cmd = self.repository.command("update", "--quiet", -
vcpx/shwrap.py
r987 r1016 49 49 DRY_RUN = False 50 50 """Don't really execute the command.""" 51 52 FORCE_ENCODING = None53 """Force the output encoding to some other charset instead of user prefs."""54 51 55 52 def __init__(self, command=None, cwd=None): … … 201 198 202 199 if input and isinstance(input, unicode): 203 input = input.encode(self.FORCE_ENCODING or getpreferredencoding()) 200 encoding = getpreferredencoding() 201 self.log.warning("Using default %s encoding, ignoring errors; " 202 "caller should use repository's encoding and " 203 "pass an already encoded input") 204 input = input.encode(encoding, 'ignore') 204 205 205 206 out, err = process.communicate(input=input) -
vcpx/tailor.py
r988 r1016 126 126 from target import SyncronizableTargetWorkingDir 127 127 from changes import Changeset 128 from locale import getpreferredencoding129 128 130 129 def pconfig(option, raw=False): … … 132 131 133 132 ExternalCommand.DEBUG = pconfig('debug') 134 encoding = pconfig('encoding')135 if encoding:136 ExternalCommand.FORCE_ENCODING = encoding137 138 # Make printouts be encoded as well. A better solution would be139 # using the replace mechanism of the encoder, and keep printing140 # in the user's LC_CTYPE/LANG setting.141 142 import codecs, sys143 sys.stdout = codecs.getwriter(encoding)(sys.stdout)144 else:145 encoding = getpreferredencoding()146 133 147 134 pname_format = pconfig('patch-name-format', raw=True) … … 158 145 self.update() 159 146 except UnicodeEncodeError, exc: 160 raise ConfigurationError('%s: it seems that current encoding "%s" ' 147 raise ConfigurationError('%s: it seems that the encoding ' 148 'used by either the source ("%s") or the ' 149 'target ("%s") repository ' 161 150 'cannot properly represent at least one ' 162 151 'of the characters in the upstream ' 163 152 'changelog. You need to use a wider ' 164 'character set, using "encoding" option.' 165 % (exc, encoding)) 153 'character set, using "encoding" option, ' 154 'or even "encoding-errors-policy".' 155 % (exc, self.source.encoding, 156 self.target.encoding)) 166 157 167 158 class RecogOption(Option): -
vcpx/monotone.py
r1006 r1016 707 707 """ 708 708 709 from locale import getpreferredencoding 710 711 encoding = ExternalCommand.FORCE_ENCODING or getpreferredencoding() 709 encode = self.repository.encode 712 710 713 711 logmessage = [] 714 712 if patchname: 715 logmessage.append(patchname .encode(encoding))713 logmessage.append(patchname) 716 714 if changelog: 717 logmessage.append(changelog .encode(encoding))715 logmessage.append(changelog) 718 716 719 717 rontf = ReopenableNamedTemporaryFile('mtn', 'tailor') 720 718 log = open(rontf.name, "w") 721 log.write( '\n'.join(logmessage))719 log.write(encode('\n'.join(logmessage))) 722 720 log.close() 723 721 724 722 cmd = self.repository.command("commit", 725 "--author", author.encode(encoding),723 "--author", encode(author), 726 724 "--date", date.isoformat(), 727 725 "--message-file", rontf.name) -
vcpx/cdv.py
r850 r1016 44 44 """ 45 45 46 from locale import getpreferredencoding 47 48 encoding = ExternalCommand.FORCE_ENCODING or getpreferredencoding() 46 encode = self.repository.encode 49 47 50 48 logmessage = [] 51 49 if patchname: 52 logmessage.append(patchname .encode(encoding))50 logmessage.append(patchname) 53 51 if changelog: 54 logmessage.append(changelog.replace('%', '%%') .encode(encoding))52 logmessage.append(changelog.replace('%', '%%')) 55 53 56 cmd = self.repository.command("-u", author.encode(encoding), "commit",57 "-m", '\n'.join(logmessage),54 cmd = self.repository.command("-u", encode(author), "commit", 55 "-m", encode('\n'.join(logmessage)), 58 56 "-D", date.strftime('%Y/%m/%d %H:%M:%S UTC')) 59 57 -
vcpx/hg.py
r992 r1016 42 42 43 43 from time import mktime 44 from locale import getpreferredencoding45 44 46 encod ing = ExternalCommand.FORCE_ENCODING or getpreferredencoding()45 encode = self.repository.encode 47 46 48 47 logmessage = [] 49 48 if patchname: 50 logmessage.append(patchname .encode(encoding))49 logmessage.append(patchname) 51 50 if changelog: 52 logmessage.append(changelog .encode(encoding))51 logmessage.append(changelog) 53 52 54 cmd = self.repository.command("commit", "-u", author.encode(encoding),53 cmd = self.repository.command("commit", "-u", encode(author), 55 54 "-l", "%(logfile)s", 56 55 "-d", "%(time)d 0") … … 59 58 rontf = ReopenableNamedTemporaryFile('hg', 'tailor') 60 59 log = open(rontf.name, "w") 61 log.write( '\n'.join(logmessage) or "Empty changelog")60 log.write(encode('\n'.join(logmessage)) or "Empty changelog") 62 61 log.close() 63 62 -
vcpx/arx.py
r850 r1016 35 35 36 36 from time import mktime 37 from locale import getpreferredencoding38 37 39 encod ing = ExternalCommand.FORCE_ENCODING or getpreferredencoding()38 encode = self.repository.encode 40 39 41 40 logmessage = [] 42 41 if patchname: 43 logmessage.append(patchname .encode(encoding))42 logmessage.append(patchname) 44 43 if changelog: 45 logmessage.append(changelog.replace('%', '%%') .encode(encoding))44 logmessage.append(changelog.replace('%', '%%')) 46 45 47 cmd = self.repository.command("commit", "-s", '\n'.join(logmessage), 48 "--author", author.encode(encoding), 46 cmd = self.repository.command("commit", 47 "-s", encode('\n'.join(logmessage)), 48 "--author", encode(author), 49 49 "--date", date.isoformat()) 50 50 c = ExternalCommand(cwd=self.basedir, command=cmd) -
vcpx/cg.py
r992 r1016 62 62 from os import environ 63 63 64 encode = self.repository.encode 65 64 66 logmessage = [] 65 67 if patchname: … … 73 75 (name, email) = self.__parse_author(author) 74 76 if name: 75 env['GIT_AUTHOR_NAME'] =name77 env['GIT_AUTHOR_NAME'] = encode(name) 76 78 if email: 77 79 env['GIT_AUTHOR_EMAIL']=email … … 83 85 c = ExternalCommand(cwd=self.basedir, command=cmd) 84 86 85 c.execute(env=env, input= '\n'.join(logmessage))87 c.execute(env=env, input=encode('\n'.join(logmessage))) 86 88 if c.exit_status: 87 89 raise ChangesetApplicationFailure("%s returned status %d" % … … 178 180 ignore.write('\n') 179 181 ignore.close() 180 -
vcpx/git.py
r1013 r1016 198 198 from os import environ 199 199 200 encode = self.repository.encode 201 200 202 logmessage = [] 201 203 if patchname: … … 209 211 (name, email) = self.__parse_author(author) 210 212 if name: 211 env['GIT_AUTHOR_NAME'] =name212 env['GIT_COMMITTER_NAME'] =name213 env['GIT_AUTHOR_NAME'] = encode(name) 214 env['GIT_COMMITTER_NAME'] = encode(name) 213 215 if email: 214 216 env['GIT_AUTHOR_EMAIL']=email … … 222 224 c = ExternalCommand(cwd=self.basedir, command=cmd) 223 225 224 logmessage = '\n'.join(logmessage)226 logmessage = encode('\n'.join(logmessage)) 225 227 if not logmessage.endswith('\n'): 226 228 logmessage += '\n' -
vcpx/hglib.py
r1008 r1016 185 185 from time import mktime 186 186 187 encod ing = self.repository.encoding187 encode = self.repository.encode 188 188 189 189 logmessage = [] … … 193 193 logmessage.append(changelog) 194 194 if logmessage: 195 logmessage = '\n'.join(logmessage).encode(encoding)195 logmessage = encode('\n'.join(logmessage)) 196 196 else: 197 197 logmessage = "Empty changelog" 198 self._hg.commit(names and [ n.encode(encoding) for n in names] or [],199 logmessage, author.encode(encoding),198 self._hg.commit(names and [encode(n) for n in names] or [], 199 logmessage, encode(author), 200 200 "%d 0" % mktime(date.timetuple())) 201 201 … … 208 208 # This seems gross. I don't get why I'm getting a unicode tag when 209 209 # it's just ascii underneath. Something weird is happening in CVS. 210 tag = tag.encode(self.repository.encoding) 210 tag = self.repository.encode(tag) 211 211 212 # CVS can't tell when a tag was applied so it tends to pass around 212 213 # too many. We want to support retagging so we can't just ignore
Note: See TracChangeset
for help on using the changeset viewer.
