Changeset 448 in tailor
- Timestamp:
- 07/30/05 02:20:10 (8 years ago)
- Hash name:
- 20050730002010-97f81-9b093a9d05e23d67767aa14c0ec4b8ebf302a9a8
- File:
-
- 1 edited
-
vcpx/darcs.py (modified) (24 diffs)
Legend:
- Unmodified
- Added
- Removed
-
vcpx/darcs.py
r433 r448 4 4 # :Autore: Lele Gaifax <lele@nautilus.homeip.net> 5 5 # :Licenza: GNU General Public License 6 # 6 # 7 7 8 8 """ … … 31 31 Return a list of ``Changeset`` instances. 32 32 """ 33 33 34 34 from xml.sax import parse 35 35 from xml.sax.handler import ContentHandler … … 48 48 else: 49 49 self.darcsdiff = None 50 50 51 51 def startElement(self, name, attributes): 52 52 if name == 'patch': … … 82 82 self.current['comment'], 83 83 self.current['entries']) 84 84 85 85 if self.darcsdiff: 86 86 cset.unidiff = self.darcsdiff.execute( 87 87 stdout=PIPE, patchname=cset.revision).read() 88 88 89 89 self.changesets.append(cset) 90 90 self.current = None … … 115 115 parse(changes, handler) 116 116 changesets = handler.changesets 117 117 118 118 # sort changeset by date 119 119 changesets.sort(lambda x, y: cmp(x.date, y.date)) … … 121 121 return changesets 122 122 123 123 124 124 class DarcsWorkingDir(UpdatableSourceWorkingDir,SyncronizableTargetWorkingDir): 125 125 """ … … 128 128 129 129 ## UpdatableSourceWorkingDir 130 130 131 131 def getUpstreamChangesets(self, root, repository, module, sincerev=None): 132 132 """ … … 137 137 from time import strptime 138 138 from changes import Changeset 139 139 140 140 cmd = [DARCS_CMD, "pull", "--dry-run"] 141 141 pull = ExternalCommand(cwd=root, command=cmd) 142 142 output = pull.execute(repository, stdout=PIPE, stderr=STDOUT, TZ='UTC') 143 143 144 144 if pull.exit_status: 145 145 raise GetUpstreamChangesetsFailure( … … 191 191 192 192 return changesets 193 193 194 194 def _applyChangeset(self, root, changeset, logger=None): 195 195 """ … … 198 198 199 199 from re import escape 200 200 201 201 if changeset.revision.startswith('tagged '): 202 202 selector = '--tags' … … 205 205 selector = '--patches' 206 206 revtag = escape(changeset.revision) 207 207 208 208 cmd = [DARCS_CMD, "pull", "--all", selector, revtag] 209 209 pull = ExternalCommand(cwd=root, command=cmd) 210 210 output = pull.execute(stdout=PIPE, stderr=STDOUT) 211 211 212 212 if pull.exit_status: 213 213 raise ChangesetApplicationFailure( … … 232 232 from os import mkdir 233 233 from re import escape 234 234 235 235 if revision == 'INITIAL': 236 236 initial = True … … 271 271 dpull = ExternalCommand(cwd=wdir, command=cmd) 272 272 output = dpull.execute(repository, stdout=PIPE, stderr=STDOUT) 273 273 274 274 if dpull.exit_status: 275 275 raise TargetInitializationFailure( … … 284 284 output = dget.execute(repository, subdir, 285 285 stdout=PIPE, stderr=STDOUT) 286 286 287 287 if dget.exit_status: 288 288 raise TargetInitializationFailure( … … 293 293 changes = ExternalCommand(cwd=wdir, command=cmd) 294 294 output = changes.execute(stdout=PIPE, stderr=STDOUT) 295 295 296 296 if changes.exit_status: 297 297 raise ChangesetApplicationFailure( 298 298 "%s returned status %d saying \"%s\"" % 299 299 (str(changes), changes.exit_status, output.read())) 300 300 301 301 last = changesets_from_darcschanges(output) 302 302 303 303 return last[0] 304 304 305 305 306 306 ## SyncronizableTargetWorkingDir 307 307 308 308 def _addPathnames(self, root, names): 309 309 """ … … 313 313 cmd = [DARCS_CMD, "add", "--case-ok", "--not-recursive", "--quiet"] 314 314 ExternalCommand(cwd=root, command=cmd).execute(names) 315 315 316 316 def _addSubtree(self, root, subdir): 317 317 """ … … 321 321 cmd = [DARCS_CMD, "add", "--case-ok", "--recursive", "--quiet"] 322 322 ExternalCommand(cwd=root, command=cmd).execute(subdir) 323 323 324 324 def _commit(self, root, date, author, remark, changelog=None, entries=None): 325 325 """ … … 328 328 329 329 from sys import getdefaultencoding 330 330 331 331 encoding = ExternalCommand.FORCE_ENCODING or getdefaultencoding() 332 332 … … 342 342 if not entries: 343 343 entries = ['.'] 344 344 345 345 record = ExternalCommand(cwd=root, command=cmd) 346 346 record.execute(entries, input='\n'.join(logmessage), stdout=PIPE) 347 347 348 348 if record.exit_status: 349 349 raise ChangesetApplicationFailure( 350 350 "%s returned status %d" % (str(record), record.exit_status)) 351 351 352 352 def _removePathnames(self, root, names): 353 353 """ … … 357 357 # Since the source VCS already deleted the entry, and given that 358 358 # darcs will do the right thing with it, do nothing here, instead 359 # of 359 # of 360 360 # c = ExternalCommand(cwd=root, 361 361 # command=[DARCS_CMD, "remove"]) … … 364 364 365 365 pass 366 366 367 367 def _renamePathname(self, root, oldname, newname): 368 368 """ … … 372 372 from os.path import join, exists 373 373 from os import rename 374 374 375 375 # Check to see if the oldentry is still there. If it does, 376 376 # that probably means one thing: it's been moved and then … … 416 416 ignored = [line for line in boring if line <> '\.cvsignore$\n'] 417 417 boring.close() 418 418 419 419 # Augment the boring file, that contains a regexp per line 420 420 # with all known VCs metadirs to be skipped. … … 425 425 boring.write('\n^tailor.log$\n^tailor.info$\n') 426 426 boring.close() 427 427 428 428 SyncronizableTargetWorkingDir._initializeWorkingDir(self, root, 429 429 repository, module,
Note: See TracChangeset
for help on using the changeset viewer.
