Changeset 643 in tailor
- Timestamp:
- 08/19/05 22:50:47 (8 years ago)
- Hash name:
- 20050819205047-97f81-2b0f2caee3550be011d1dcb4ec300abca6952c47
- Files:
-
- 1 deleted
- 2 edited
-
vcpx/tailor.py (modified) (3 diffs)
-
README (modified) (1 diff)
-
vcpx/session.py (deleted)
Legend:
- Unmodified
- Added
- Removed
-
vcpx/tailor.py
r642 r643 18 18 from project import Project 19 19 from source import InvocationError 20 from session import interactive21 20 22 21 class Tailorizer(Project): … … 158 157 159 158 GENERAL_OPTIONS = [ 160 make_option("-i", "--interactive", default=False, action="store_true",161 help="Start an interactive session."),162 159 make_option("-D", "--debug", dest="debug", 163 160 action="store_true", default=False, … … 300 297 options, args = parser.parse_args() 301 298 302 if options.interactive: 303 interactive(options, args) 299 defaults = {} 300 for k,v in options.__dict__.items(): 301 if k <> 'configfile': 302 defaults[k.replace('_', '-')] = str(v) 303 304 if options.configfile or (len(sys.argv)==2 and len(args)==1): 305 # Either we have a --configfile, or there are no options 306 # and a single argument (to support shebang style scripts) 307 308 if not options.configfile: 309 options.configfile = sys.argv[1] 310 args = None 311 312 config = Config(open(options.configfile), defaults) 313 314 if not args: 315 args = config.projects() 316 317 for projname in args: 318 tailorizer = Tailorizer(projname, config) 319 tailorizer() 304 320 else: 305 defaults = {} 306 for k,v in options.__dict__.items(): 307 if k not in ['interactive', 'configfile']: 308 defaults[k.replace('_', '-')] = str(v) 309 310 if options.configfile or (len(sys.argv)==2 and len(args)==1): 311 # Either we have a --configfile, or there are no options 312 # and a single argument (to support shebang style scripts) 313 314 if not options.configfile: 315 options.configfile = sys.argv[1] 316 args = None 317 318 config = Config(open(options.configfile), defaults) 319 320 if not args: 321 args = config.projects() 322 323 for projname in args: 324 tailorizer = Tailorizer(projname, config) 325 tailorizer() 326 else: 327 for omit in ['source-kind', 'target-kind', 328 'source-module', 'target-module', 329 'source-repository', 'target-repository', 330 'start-revision', 'subdir']: 331 if omit in defaults: 332 del defaults[omit] 333 334 config = Config(None, defaults) 335 336 config.add_section('project') 337 source = options.source_kind + ':source' 338 config.set('project', 'source', source) 339 target = options.target_kind + ':target' 340 config.set('project', 'target', target) 341 config.set('project', 'root-directory', getcwd()) 342 config.set('project', 'subdir', options.subdir or '.') 343 config.set('project', 'state-file', 'tailor.state') 344 config.set('project', 'start-revision', options.start_revision) 345 346 config.add_section(source) 347 config.set(source, 'repository', options.source_repository) 348 if options.source_module: 349 config.set(source, 'module', options.source_module) 350 351 config.add_section(target) 352 if options.target_repository: 353 config.set(target, 'repository', options.target_repository) 354 if options.target_module: 355 config.set(target, 'module', options.target_module) 356 357 if options.verbose: 358 import sys 359 360 sys.stderr.write("You should put the following configuration " 361 "in some file, adjust it as needed\n" 362 "and use --configfile option with that " 363 "file as argument:\n") 364 config.write(sys.stdout) 365 366 if options.debug: 367 tailorizer = Tailorizer('project', config) 368 tailorizer() 369 elif not options.verbose: 370 sys.stderr.write("Operation not performed, try --verbose\n") 321 for omit in ['source-kind', 'target-kind', 322 'source-module', 'target-module', 323 'source-repository', 'target-repository', 324 'start-revision', 'subdir']: 325 if omit in defaults: 326 del defaults[omit] 327 328 config = Config(None, defaults) 329 330 config.add_section('project') 331 source = options.source_kind + ':source' 332 config.set('project', 'source', source) 333 target = options.target_kind + ':target' 334 config.set('project', 'target', target) 335 config.set('project', 'root-directory', getcwd()) 336 config.set('project', 'subdir', options.subdir or '.') 337 config.set('project', 'state-file', 'tailor.state') 338 config.set('project', 'start-revision', options.start_revision) 339 340 config.add_section(source) 341 config.set(source, 'repository', options.source_repository) 342 if options.source_module: 343 config.set(source, 'module', options.source_module) 344 345 config.add_section(target) 346 if options.target_repository: 347 config.set(target, 'repository', options.target_repository) 348 if options.target_module: 349 config.set(target, 'module', options.target_module) 350 351 if options.verbose: 352 import sys 353 354 sys.stderr.write("You should put the following configuration " 355 "in some file, adjust it as needed\n" 356 "and use --configfile option with that " 357 "file as argument:\n") 358 config.write(sys.stdout) 359 360 if options.debug: 361 tailorizer = Tailorizer('project', config) 362 tailorizer() 363 elif not options.verbose: 364 sys.stderr.write("Operation not performed, try --verbose\n") -
README
r639 r643 361 361 will fetch latest changes from the upstream repository. 362 362 363 Interactive sessions364 --------------------365 366 Tailor offers an alternative way of driving its activity by using an367 interactive session, bringing the configuration more similar to a368 script.369 370 Although this is still a work-in-progress, it's quickly becoming my371 preferred usage, as its functionality cover the underlying tailor372 features.373 374 For example, this is the script I'm using to test it::375 376 cd /tmp377 state_file tailor.state378 source_kind darcs379 target_kind svn380 source_repository /home/lele/WiP/cvsync381 sub_directory cvsync382 refill_changelogs no383 patch_name_format [%(module)s] Changeset %(revision)s by %(author)s384 385 that, as you can see, specifies the context needed by tailor to do its386 work. With the following command line::387 388 $ tailor --verbose --interactive tailor.cmds389 Welcome to the Tailor interactive session: you can issue several commands390 with the usual `readline` facilities. With "help" you'll get a list of391 available commands.392 393 Current directory: /tmp394 Current state file: /tmp/tailor.state395 Current source kind: darcs396 Current target kind: svn397 Current source repository: /home/lele/WiP/cvsync398 Sub directory: cvsync399 Refill changelogs: False400 Patch name format: [%(module)s] Changeset %(revision)s by %(author)s401 tailor $ help402 403 Documented commands (type help <topic>):404 ========================================405 EOF print_executed_commands state_file406 bootstrap refill_changelogs sub_directory407 cd remove_first_log_line target_kind408 current_directory save target_module409 exit source_kind target_repository410 logfile source_module411 patch_name_format source_repository412 413 Undocumented commands:414 ======================415 help416 417 tailor $ help bootstrap418 419 Usage: bootstrap [revision]420 421 Checkout the initial upstream revision, by default HEAD (or422 specified by argument), then import the subtree into the423 target repository.424 425 As another example, consider the following commands::426 427 cd /tmp/wc428 state_file tailor.state429 source_kind cvs430 target_kind darcs431 source_repository :pserver:anonymous@cvs.sourceforge.net:/cvsroot/buildbot432 source_module buildbot433 refill_changelogs false434 patch_name_format %(firstlogline)s435 print_executed_commands true436 bootstrap 2004/01/01 20:05:24437 update ask438 439 Assuming ``/tmp/wc`` exists, executing them will first bootstrap a new440 darcs repository with a snapshot at the given date of the upstream441 sources, then will proceed with the update, asking confirmation about442 any single changeset::443 444 ...445 Collected 586 upstream changesets446 Changeset 2004-01-07 00:42:07 by warner:447 * buildbot/changes/mail.py (parseFreshCVSMail): ....448 * test/test_mailparse.py (Test1.testMsg9): test for same449 450 Apply [Y/n/v/h/q]? h451 y: yes, apply it and keep going452 n: no, skip the current changeset453 v: view more detailed information454 q: do not apply the current changeset and stop iterating455 456 Apply [Y/n/v/h/q]? v457 Revision: 2004-01-07 00:42:07 by warner458 Date: 2004-01-07 00:42:07459 Author: warner460 Modified: ChangeLog,buildbot/changes/mail.py,test/test_mailparse.py461 Added: test/mail/msg9462 Log: * buildbot/changes/mail.py (parseFreshCVSMail): ...463 * test/test_mailparse.py (Test1.testMsg9): test for same464 465 Apply [Y/n/v/h/q]?466 467 363 468 364 Further help
Note: See TracChangeset
for help on using the changeset viewer.
