Changeset 777 in tailor
- Timestamp:
- 09/07/05 14:50:48 (8 years ago)
- Hash name:
- 20050907125048-7a6fb-fc048cd801e38c478f7abdbb84305d06201fbe2f
- Location:
- vcpx
- Files:
-
- 13 edited
-
cvsps.py (modified) (6 diffs)
-
darcs.py (modified) (15 diffs)
-
svn.py (modified) (15 diffs)
-
cvs.py (modified) (1 diff)
-
monotone.py (modified) (16 diffs)
-
cdv.py (modified) (7 diffs)
-
bzr.py (modified) (5 diffs)
-
hg.py (modified) (6 diffs)
-
repository.py (modified) (10 diffs)
-
arx.py (modified) (4 diffs)
-
tla.py (modified) (7 diffs)
-
cg.py (modified) (4 diffs)
-
baz.py (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
vcpx/cvsps.py
r745 r777 159 159 160 160 changesets = [] 161 cmd = [self.repository.CVSPS_CMD, "--cvs-direct", "-u", "-b", branch, 162 "--root", self.repository.repository] 161 cmd = self.repository.command("--cvs-direct", "-u", "-b", branch, 162 "--root", self.repository.repository, 163 cvsps=True) 163 164 cvsps = ExternalCommand(command=cmd) 164 165 log = cvsps.execute(self.repository.module, stdout=PIPE, TZ='UTC')[0] … … 223 224 rmtree(join(self.basedir, e.name)) 224 225 else: 225 cmd = [self.repository.CVS_CMD, "-q", "update", "-d", "-r", e.new_revision] 226 cmd = self.repository.command("-q", "update", "-d", 227 "-r", e.new_revision) 226 228 cvsup = ExternalCommand(cwd=self.basedir, command=cmd) 227 229 retry = 0 … … 293 295 294 296 if not exists(join(self.basedir, 'CVS')): 295 cmd = [self.repository.CVS_CMD, "-q", "-d", 296 self.repository.repository, "checkout", 297 "-d", self.repository.subdir] 297 cmd = self.repository.command("-q", 298 "-d", self.repository.repository, 299 "checkout", 300 "-d", self.repository.subdir) 298 301 if revision: 299 302 cmd.extend(["-r", revision]) … … 438 441 """ 439 442 440 cmd = [self.repository.CVS_CMD, "-q", "add"]443 cmd = self.repository.command("-q", "add") 441 444 ExternalCommand(cwd=self.basedir, command=cmd).execute(names) 442 445 … … 512 515 log.close() 513 516 514 cmd = [self.repository.CVS_CMD, "-q", "ci", "-F", rontf.name]517 cmd = self.repository.command("-q", "ci", "-F", rontf.name) 515 518 if not entries: 516 519 entries = ['.'] … … 528 531 """ 529 532 530 cmd = [self.repository.CVS_CMD, "-q", "remove"]533 cmd = self.repository.command("-q", "remove") 531 534 ExternalCommand(cwd=self.basedir, command=cmd).execute(names) 532 535 -
vcpx/darcs.py
r776 r777 142 142 from changes import Changeset 143 143 144 cmd = [self.repository.DARCS_CMD, "pull", "--dry-run"]144 cmd = self.repository.command("pull", "--dry-run") 145 145 pull = ExternalCommand(cwd=self.basedir, command=cmd) 146 146 output = pull.execute(self.repository.repository, … … 225 225 needspatchesopt = True 226 226 227 cmd = [self.repository.DARCS_CMD,"pull", "--all", "--quiet",228 selector, revtag]227 cmd = self.repository.command("pull", "--all", "--quiet", 228 selector, revtag) 229 229 230 230 if needspatchesopt: … … 249 249 line = output.readline() 250 250 251 cmd = [self.repository.DARCS_CMD,"changes", selector, revtag,252 "--xml-output", "--summ"]251 cmd = self.repository.command("changes", selector, revtag, 252 "--xml-output", "--summ") 253 253 changes = ExternalCommand(cwd=self.basedir, command=cmd) 254 254 last = changesets_from_darcschanges(changes.execute(stdout=PIPE)[0]) … … 269 269 self.log_info("Reverting changes to '%s', to solve the conflict" % 270 270 ' '.join(conflict)) 271 cmd = [self.repository.DARCS_CMD, "revert", "--all"]271 cmd = self.repository.command("revert", "--all") 272 272 revert = ExternalCommand(cwd=self.basedir, command=cmd) 273 273 revert.execute(conflict) … … 285 285 if revision == 'INITIAL': 286 286 initial = True 287 cmd = [self.repository.DARCS_CMD,"changes", "--xml-output",288 "--repo", self.repository.repository]287 cmd = self.repository.command("changes", "--xml-output", 288 "--repo", self.repository.repository) 289 289 changes = ExternalCommand(command=cmd) 290 290 output = changes.execute(stdout=PIPE, stderr=STDOUT)[0] … … 310 310 mkdir(self.basedir) 311 311 312 init = ExternalCommand(cwd=self.basedir, 313 command=[self.repository.DARCS_CMD, 314 "initialize"]) 312 cmd = self.repository.command("initialize") 313 init = ExternalCommand(cwd=self.basedir, command=cmd) 315 314 init.execute() 316 315 … … 320 319 init.exit_status)) 321 320 322 cmd = [self.repository.DARCS_CMD, "pull", "--all", "--quiet"]321 cmd = self.repository.command("pull", "--all", "--quiet") 323 322 if revision and revision<>'HEAD': 324 323 cmd.extend([initial and "--match" or "--tag", revision]) … … 333 332 else: 334 333 # Use much faster 'darcs get' 335 cmd = [self.repository.DARCS_CMD, "get", "--partial", "--quiet"]334 cmd = self.repository.command("get", "--partial", "--quiet") 336 335 if revision and revision<>'HEAD': 337 336 cmd.extend([initial and "--to-match" or "--tag", revision]) … … 345 344 (str(dget), dget.exit_status, output.read())) 346 345 347 cmd = [self.repository.DARCS_CMD,"changes", "--last", "1",348 "--xml-output"]346 cmd = self.repository.command("changes", "--last", "1", 347 "--xml-output") 349 348 changes = ExternalCommand(cwd=self.basedir, command=cmd) 350 349 output = changes.execute(stdout=PIPE, stderr=STDOUT)[0] … … 367 366 """ 368 367 369 cmd = [self.repository.DARCS_CMD, "add", "--case-ok",370 "--not-recursive", "--quiet"]368 cmd = self.repository.command("add", "--case-ok", "--not-recursive", 369 "--quiet") 371 370 ExternalCommand(cwd=self.basedir, command=cmd).execute(names) 372 371 … … 376 375 """ 377 376 378 cmd = [self.repository.DARCS_CMD,"add", "--case-ok", "--recursive",379 "--quiet"]377 cmd = self.repository.command("add", "--case-ok", "--recursive", 378 "--quiet") 380 379 ExternalCommand(cwd=self.basedir, command=cmd).execute(subdir) 381 380 … … 398 397 logmessage.append('Unnamed patch') 399 398 400 cmd = [self.repository.DARCS_CMD, "record", "--all", "--pipe"]399 cmd = self.repository.command("record", "--all", "--pipe") 401 400 if not entries: 402 401 entries = ['.'] … … 422 421 423 422 c = ExternalCommand(cwd=self.basedir, 424 command= [self.repository.DARCS_CMD, "remove"])423 command=self.repository.command("remove")) 425 424 c.execute([n for n in names if exists(join(self.basedir, n))]) 426 425 … … 447 446 448 447 try: 449 cmd = [self.repository.DARCS_CMD, "mv"]448 cmd = self.repository.command("mv") 450 449 ExternalCommand(cwd=self.basedir, command=cmd).execute(oldname, 451 450 newname) … … 465 464 466 465 if not exists(join(self.basedir, self.repository.METADIR)): 467 init = ExternalCommand(cwd=self.basedir, 468 command=[self.repository.DARCS_CMD, 469 "initialize"]) 466 cmd = self.repository.command("initialize") 467 init = ExternalCommand(cwd=self.basedir, command=cmd) 470 468 init.execute() 471 469 -
vcpx/svn.py
r738 r777 179 179 sincerev = 0 180 180 181 cmd = [self.repository.SVN_CMD,"log", "--verbose", "--xml",182 "--revision", "%d:HEAD" % (sincerev+1)]181 cmd = self.repository.command("log", "--verbose", "--xml", 182 "--revision", "%d:HEAD" % (sincerev+1)) 183 183 svnlog = ExternalCommand(cwd=self.basedir, command=cmd) 184 184 log = svnlog.execute('.', stdout=PIPE, TZ='UTC')[0] … … 194 194 from time import sleep 195 195 196 cmd = [self.repository.SVN_CMD,"update",197 "--revision", changeset.revision, "."]196 cmd = self.repository.command("update", 197 "--revision", changeset.revision, ".") 198 198 svnup = ExternalCommand(cwd=self.basedir, command=cmd) 199 199 … … 239 239 if revision == 'INITIAL': 240 240 initial = True 241 cmd = [self.repository.SVN_CMD, "log", "--verbose", "--xml", 242 "--limit", "1", "--revision", "1:HEAD"] 241 cmd = self.repository.command("log", "--verbose", "--xml", 242 "--limit", "1", 243 "--revision", "1:HEAD") 243 244 svnlog = ExternalCommand(command=cmd) 244 245 output = svnlog.execute("%s%s" % (self.repository.repository, … … 260 261 if not exists(join(self.basedir, '.svn')): 261 262 self.log_info("checking out a working copy") 262 cmd = [self.repository.SVN_CMD,"co", "--quiet",263 "--revision", revision]263 cmd = self.repository.command("co", "--quiet", 264 "--revision", revision) 264 265 svnco = ExternalCommand(command=cmd) 265 266 svnco.execute("%s%s" % (self.repository.repository, … … 272 273 273 274 if not initial: 274 cmd = [self.repository.SVN_CMD,"log", "--verbose", "--xml",275 "--revision", revision=='HEAD' and 'COMMITTED' or revision]275 cmd = self.repository.command("log", "--verbose", "--xml", 276 "--revision", revision=='HEAD' and 'COMMITTED' or revision) 276 277 svnlog = ExternalCommand(cwd=self.basedir, command=cmd) 277 278 output = svnlog.execute(stdout=PIPE)[0] … … 299 300 """ 300 301 301 cmd = [self.repository.SVN_CMD,"add", "--quiet", "--no-auto-props",302 "--non-recursive"]302 cmd = self.repository.command("add", "--quiet", "--no-auto-props", 303 "--non-recursive") 303 304 ExternalCommand(cwd=self.basedir, command=cmd).execute(names) 304 305 … … 344 345 log.close() 345 346 346 cmd = [self.repository.SVN_CMD,"commit", "--quiet",347 "--file", rontf.name]347 cmd = self.repository.command("commit", "--quiet", 348 "--file", rontf.name) 348 349 commit = ExternalCommand(cwd=self.basedir, command=cmd) 349 350 … … 358 359 359 360 if self.USE_PROPSET: 360 cmd = [self.repository.SVN_CMD,"propset", "%(propname)s",361 "--quiet", "--revprop", "-rHEAD"]361 cmd = self.repository.command("propset", "%(propname)s", 362 "--quiet", "--revprop", "-rHEAD") 362 363 propset = ExternalCommand(cwd=self.basedir, command=cmd) 363 364 … … 365 366 propset.execute(author, propname='svn:author') 366 367 367 cmd = [self.repository.SVN_CMD, "update", "--quiet"]368 cmd = self.repository.command("update", "--quiet") 368 369 ExternalCommand(cwd=self.basedir, command=cmd).execute() 369 370 … … 373 374 """ 374 375 375 cmd = [self.repository.SVN_CMD, "remove", "--quiet", "--force"]376 cmd = self.repository.command("remove", "--quiet", "--force") 376 377 remove = ExternalCommand(cwd=self.basedir, command=cmd) 377 378 remove.execute(names) … … 382 383 """ 383 384 384 cmd = [self.repository.SVN_CMD, "mv", "--quiet"]385 cmd = self.repository.command("mv", "--quiet") 385 386 move = ExternalCommand(cwd=self.basedir, command=cmd) 386 387 move.execute(oldname, newname) … … 402 403 assert target_repository.startswith('file:///') 403 404 404 cmd = [self.repository.SVNADMIN_CMD, "create", "--fs-type", "fsfs"] 405 cmd = self.repository.command("create", "--fs-type", "fsfs", 406 svnadmin=True) 405 407 svnadmin = ExternalCommand(command=cmd) 406 408 svnadmin.execute(target_repository[7:]) … … 412 414 413 415 if target_module and target_module <> '/': 414 cmd = [self.repository.SVN_CMD, "mkdir", "-m", 415 "This directory will host the upstream sources"] 416 cmd = self.repository.command("mkdir", "-m", 417 "This directory will host the " 418 "upstream sources") 416 419 svnmkdir = ExternalCommand(command=cmd) 417 420 svnmkdir.execute(target_repository + target_module) … … 431 434 432 435 # Verify the existence of repository by listing its root 433 cmd = [self.repository.SVN_CMD, "ls"]436 cmd = self.repository.command("ls") 434 437 svnls = ExternalCommand(command=cmd) 435 438 svnls.execute(self.repository.repository) … … 456 459 return 457 460 458 cmd = [self.repository.SVN_CMD, "co", "--quiet"]461 cmd = self.repository.command("co", "--quiet") 459 462 svnco = ExternalCommand(command=cmd) 460 463 svnco.execute("%s%s" % (self.repository.repository, -
vcpx/cvs.py
r775 r777 307 307 branch=tag[1:-1] 308 308 309 cmd = [self.repository.CVS_CMD,"-f", "-d", "%(repository)s", "rlog",310 "-N"]309 cmd = self.repository.command("-f", "-d", "%(repository)s", "rlog", 310 "-N") 311 311 312 312 if not sincerev or sincerev in ("INITIAL", "HEAD"): -
vcpx/monotone.py
r708 r777 132 132 self.changelog="" 133 133 134 cmd = [self.repository.MONOTONE_CMD, "log", "--db", self.repository.repository, "--last", "1", "--revision", revision] 134 cmd = self.repository.command("log", "--db", self.repository.repository, 135 "--last", "1", "--revision", revision) 135 136 mtl = ExternalCommand(cwd=self.working_dir, command=cmd) 136 137 outstr = mtl.execute(stdout=PIPE) … … 299 300 300 301 # the order of revisions is very important. Monotone gives a diff from the first to the second 301 cmd = [self.repository.MONOTONE_CMD, "diff", "--db", self.repository.repository, "--revision", chset.lin_ancestor, "--revision", chset.revision] 302 cmd = self.repository.command("diff", 303 "--db", self.repository.repository, 304 "--revision", chset.lin_ancestor, 305 "--revision", chset.revision) 302 306 303 307 mtl = ExternalCommand(cwd=self.working_dir, command=cmd) … … 449 453 if revision == 'HEAD' or revision=='INITIAL': 450 454 # in both cases we need the head(s) of the requested branch 451 cmd = [self.repository.MONOTONE_CMD, "automate","heads", "--db", repository, module] 455 cmd = self.repository.command("automate","heads", 456 "--db", repository, module) 452 457 mtl = ExternalCommand(cwd=working_dir, command=cmd) 453 458 outstr = mtl.execute(stdout=PIPE) … … 466 471 if len(revision)>1: 467 472 stderr.write("Branch '%s' has multiple heads. There is no guarantee to reconstruct the full history." % module) 468 cmd = [ [self.repository.MONOTONE_CMD,"automate","ancestors",469 "--db",repository],470 [self.repository.MONOTONE_CMD,"automate","toposort",471 "--db",repository, "-@-"]473 cmd = [ self.repository.command("automate","ancestors", 474 "--db",repository), 475 self.repository.command("automate","toposort", 476 "--db",repository, "-@-") 472 477 ] 473 478 cmd[0].extend(revision) … … 486 491 # here we want ancestry order, so descendents output is feed back to 487 492 # mtn for a toposort ... 488 cmd = [ [self.repository.MONOTONE_CMD, "automate","descendents", 489 "--db",self.repository.repository, sincerev], 490 [self.repository.MONOTONE_CMD, "automate","toposort", 491 "--db",self.repository.repository, "-@-"] 493 cmd = [ self.repository.command("automate","descendents", 494 "--db", self.repository.repository, 495 sincerev), 496 self.repository.command("automate","toposort", 497 "--db", self.repository.repository, 498 "-@-") 492 499 ] 493 500 cld = ExternalCommandChain(cwd=self.repository.rootdir, command=cmd) … … 508 515 509 516 def _applyChangeset(self, changeset): 510 cmd = [self.repository.MONOTONE_CMD, "update", "--revision", changeset.revision]517 cmd = self.repository.command("update", "--revision", changeset.revision) 511 518 mtl = ExternalCommand(cwd=self.basedir, command=cmd) 512 519 mtl.execute() … … 525 532 if not exists(join(self.basedir, 'MT')): 526 533 self.log_info("checking out a working copy") 527 cmd = [self.repository.MONOTONE_CMD, "co", "--db", self.repository.repository, "--revision", effrev, 528 "--branch", self.repository.module, self.repository.subdir] 534 cmd = self.repository.command("co", 535 "--db", self.repository.repository, 536 "--revision", effrev, 537 "--branch", self.repository.module, 538 self.repository.subdir) 529 539 mtl = ExternalCommand(cwd=self.repository.rootdir, command=cmd) 530 540 mtl.execute() … … 561 571 if len(fnames): 562 572 # ok, we still have something to add 563 cmd = [self.repository.MONOTONE_CMD, "add"]573 cmd = self.repository.command("add") 564 574 add = ExternalCommand(cwd=self.basedir, command=cmd) 565 575 add.execute(fnames) … … 572 582 Add a whole subtree 573 583 """ 574 cmd = [self.repository.MONOTONE_CMD, "add"]584 cmd = self.repository.command("add") 575 585 add = ExternalCommand(cwd=self.basedir, command=cmd) 576 586 add.execute(subdir) … … 598 608 log.close() 599 609 600 cmd = [self.repository.MONOTONE_CMD,"commit", "--author", author,601 "--date", date.isoformat(),602 "--message-file", rontf.name]610 cmd = self.repository.command("commit", "--author", author, 611 "--date", date.isoformat(), 612 "--message-file", rontf.name) 603 613 commit = ExternalCommand(cwd=self.basedir, command=cmd) 604 614 … … 627 637 # so we must remove every item separately and intercept monotone directory errore messages. 628 638 # We can't just filter the directories, because the wc doesn't contain them anymore ... 629 cmd = [self.repository.MONOTONE_CMD, "drop"]639 cmd = self.repository.command("drop") 630 640 drop = ExternalCommand(cwd=self.basedir, command=cmd) 631 641 for fn in names: … … 649 659 self.log_info("preparing to rename %s->%s" % (oldname, newname)) 650 660 651 cmd = [self.repository.MONOTONE_CMD, "rename"]661 cmd = self.repository.command("rename") 652 662 rename = ExternalCommand(cwd=self.basedir, command=cmd) 653 663 rename.execute(oldname, newname) … … 663 673 """ 664 674 665 cmd = [self.repository.MONOTONE_CMD,"db", "init", "--db",666 target_repository.repository]675 cmd = self.repository.command("db", "init", "--db", 676 target_repository.repository) 667 677 init = ExternalCommand(command=cmd) 668 678 init.execute() … … 676 686 # a key file is available, read into the database 677 687 keyfile = file(target_repository.keyfile) 678 cmd = [self.repository.MONOTONE_CMD,"read", "--db",679 target_repository.repository]688 cmd = self.repository.command("read", "--db", 689 target_repository.repository) 680 690 regkey = ExternalCommand(command=cmd) 681 691 regkey.execute(input=keyfile) … … 688 698 "A keyfile or keyid must be provided." % 689 699 target_repository) 690 cmd = [self.repository.MONOTONE_CMD,"genkey", "--db",691 target_repository.repository]700 cmd = self.repository.command("genkey", "--db", 701 target_repository.repository) 692 702 regkey = ExternalCommand(command=cmd) 693 703 if target_repository.passphrase: … … 724 734 return 725 735 726 cmd = [self.repository.MONOTONE_CMD, "setup", 727 "--db", self.repository.repository, "--branch", self.repository.module] 736 cmd = self.repository.command("setup", 737 "--db", self.repository.repository, 738 "--branch", self.repository.module) 728 739 729 740 if not self.repository.module: -
vcpx/cdv.py
r752 r777 28 28 29 29 names = [e.name for e in changeset.modifiedEntries()] 30 cmd = [self.repository.CDV_CMD, "edit"]30 cmd = self.repository.command("edit") 31 31 ExternalCommand(cwd=self.basedir, command=cmd).execute(names) 32 32 … … 36 36 """ 37 37 38 cmd = [self.repository.CDV_CMD, "add"]38 cmd = self.repository.command("add") 39 39 ExternalCommand(cwd=self.basedir, command=cmd).execute(names) 40 40 … … 54 54 logmessage.append(changelog.replace('%', '%%').encode(encoding)) 55 55 56 cmd = [self.repository.CDV_CMD,"-u", author.encode(encoding), "commit",57 "-m", '\n'.join(logmessage),58 "-D", date.strftime('%Y/%m/%d %H:%M:%S UTC')]56 cmd = self.repository.command("-u", author.encode(encoding), "commit", 57 "-m", '\n'.join(logmessage), 58 "-D", date.strftime('%Y/%m/%d %H:%M:%S UTC')) 59 59 60 60 if not entries: … … 73 73 """ 74 74 75 cmd = [self.repository.CDV_CMD, "remove"]75 cmd = self.repository.command("remove") 76 76 ExternalCommand(cwd=self.basedir, command=cmd).execute(names) 77 77 … … 81 81 """ 82 82 83 cmd = [self.repository.CDV_CMD, "rename"]83 cmd = self.repository.command("rename") 84 84 ExternalCommand(cwd=self.basedir, command=cmd).execute(oldname, newname) 85 85 … … 95 95 if not exists(join(self.basedir, self.repository.METADIR)): 96 96 init = ExternalCommand(cwd=self.basedir, 97 command= [self.repository.CDV_CMD, "init"])97 command=self.repository.command("init")) 98 98 init.execute() 99 99 … … 110 110 from os.path import join 111 111 112 cmd = [self.repository.CDV_CMD, "set", "user"]112 cmd = self.repository.command("set", "user") 113 113 user = getenv('CDV_USER') or getenv('LOGNAME') 114 114 ExternalCommand(cwd=self.basedir, command=cmd).execute(user) -
vcpx/bzr.py
r752 r777 25 25 """ 26 26 27 cmd = [self.repository.BZR_CMD, "add"]27 cmd = self.repository.command("add") 28 28 ExternalCommand(cwd=self.basedir, command=cmd).execute(names) 29 29 … … 51 51 log.close() 52 52 53 cmd = [self.repository.BZR_CMD,"commit", "--unchanged",54 "--file", rontf.name]53 cmd = self.repository.command("commit", "--unchanged", 54 "--file", rontf.name) 55 55 if not entries: 56 56 entries = ['.'] … … 68 68 """ 69 69 70 cmd = [self.repository.BZR_CMD, "remove"]70 cmd = self.repository.command("remove") 71 71 ExternalCommand(cwd=self.basedir, command=cmd).execute(names) 72 72 … … 76 76 """ 77 77 78 cmd = [self.repository.BZR_CMD, "rename"]78 cmd = self.repository.command("rename") 79 79 ExternalCommand(cwd=self.basedir, command=cmd).execute(oldname, newname) 80 80 … … 89 89 90 90 if not exists(join(self.basedir, self.repository.METADIR)): 91 cmd = [self.repository.BZR_CMD, "init"]91 cmd = self.repository.command("init") 92 92 init = ExternalCommand(cwd=self.basedir, command=cmd) 93 93 init.execute() -
vcpx/hg.py
r752 r777 32 32 notdirs = [n for n in names if not isdir(join(self.basedir, n))] 33 33 if notdirs: 34 cmd = [self.repository.HG_CMD, "add"]34 cmd = self.repository.command("add") 35 35 ExternalCommand(cwd=self.basedir, command=cmd).execute(notdirs) 36 36 … … 51 51 logmessage.append(changelog.encode(encoding)) 52 52 53 cmd = [self.repository.HG_CMD,"commit", "-u", author,54 "-l", "%(logfile)s",55 "-d", "%(time)d 0"]53 cmd = self.repository.command("commit", "-u", author, 54 "-l", "%(logfile)s", 55 "-d", "%(time)d 0") 56 56 c = ExternalCommand(cwd=self.basedir, command=cmd) 57 57 … … 79 79 notdirs = [n for n in names if not isdir(join(self.basedir, n))] 80 80 if notdirs: 81 cmd = [self.repository.HG_CMD, "remove"]81 cmd = self.repository.command("remove") 82 82 ExternalCommand(cwd=self.basedir, command=cmd).execute(notdirs) 83 83 … … 91 91 from dualwd import IGNORED_METADIRS 92 92 93 cmd = [self.repository.HG_CMD, "copy"]93 cmd = self.repository.command("copy") 94 94 copy = ExternalCommand(cwd=self.basedir, command=cmd) 95 95 if isdir(join(self.basedir, newname)): … … 120 120 if not exists(join(self.basedir, self.repository.METADIR)): 121 121 init = ExternalCommand(cwd=self.basedir, 122 command= [self.repository.HG_CMD, "init"])122 command=self.repository.command("init")) 123 123 init.execute() 124 124 … … 162 162 163 163 ExternalCommand(cwd=self.basedir, 164 command= [self.repository.HG_CMD, "addremove"]).execute()164 command=self.repository.command("addremove")).execute() -
vcpx/repository.py
r755 r777 23 23 METADIR = None 24 24 EXTRA_METADIRS = [] 25 EXECUTABLE = None 25 26 26 27 def __new__(klass, name, project, which): … … 90 91 """ 91 92 93 if self.EXECUTABLE: 94 from os import getenv 95 from os.path import isabs, exists, join 96 from vcpx.config import ConfigurationError 97 98 if isabs(self.EXECUTABLE): 99 ok = exists(self.EXECUTABLE) 100 else: 101 ok = False 102 for path in getenv('PATH').split(':'): 103 if exists(join(path, self.EXECUTABLE)): 104 ok = True 105 break 106 if not ok: 107 raise ConfigurationError("The command %r used " 108 "by %r does not exist!" % 109 (self.EXECUTABLE, self.name)) 110 92 111 def log_info(self, what): 93 112 """ … … 123 142 return workingdir(self) 124 143 144 def command(self, *args, **kwargs): 145 """ 146 Return the base external command, a sequence suitable to be used 147 to init an ExternalCommand instance. 148 149 This return None if the backend uses a different way to execute 150 its actions. 151 """ 152 153 executable = kwargs.get('executable', self.EXECUTABLE) 154 if executable: 155 cmd = [executable] 156 cmd.extend(args) 157 return cmd 125 158 126 159 class ArxRepository(Repository): 127 160 METADIR = '_arx' 128 ARX_CMD = "arx" 129 130 def _load(self, config): 131 Repository._load(self, config) 132 self.ARX_CMD = config.get(self.name, 'arx-command', self.ARX_CMD) 161 162 def _load(self, config): 163 Repository._load(self, config) 164 self.EXECUTABLE = config.get(self.name, 'arx-command', 'arx') 133 165 134 166 135 167 class BazRepository(Repository): 136 168 METADIR = '{arch}' 137 BAZ_CMD = "baz" 138 139 def _load(self, config): 140 Repository._load(self, config) 141 self.BAZ_CMD = config.get(self.name, 'baz-command', self.BAZ_CMD) 169 170 def _load(self, config): 171 Repository._load(self, config) 172 self.EXECUTABLE = config.get(self.name, 'baz-command', 'baz') 142 173 143 174 144 175 class BzrRepository(Repository): 145 176 METADIR = '.bzr' 146 BZR_CMD = 'bzr' 147 148 def _load(self, config): 149 Repository._load(self, config) 150 self.BZR_CMD = config.get(self.name, 'bzr-command', self.BZR_CMD) 177 178 def _load(self, config): 179 Repository._load(self, config) 180 self.EXECUTABLE = config.get(self.name, 'bzr-command', 'bzr') 151 181 152 182 … … 166 196 class CdvRepository(Repository): 167 197 METADIR = '.cdv' 168 CDV_CMD = 'cdv' 169 170 def _load(self, config): 171 Repository._load(self, config) 172 self.CDV_CMD = config.get(self.name, 'cdv-command', self.CDV_CMD) 198 199 def _load(self, config): 200 Repository._load(self, config) 201 self.EXECUTABLE = config.get(self.name, 'cdv-command', 'cdv') 173 202 174 203 175 204 class CgRepository(Repository): 176 205 METADIR = '.git' 177 CG_CMD = 'cg' 178 179 def _load(self, config): 180 Repository._load(self, config) 181 self.CG_CMD = config.get(self.name, 'cg-command', self.CG_CMD) 206 207 def _load(self, config): 208 Repository._load(self, config) 209 self.EXECUTABLE = config.get(self.name, 'cg-command', 'cg') 182 210 183 211 184 212 class CvsRepository(Repository): 185 213 METADIR = 'CVS' 186 CVS_CMD = 'cvs' 187 188 def _load(self, config): 189 Repository._load(self, config) 190 self.CVS_CMD = config.get(self.name, 'cvs-command', self.CVS_CMD) 214 215 def _load(self, config): 216 Repository._load(self, config) 217 self.EXECUTABLE = config.get(self.name, 'cvs-command', 'cvs') 191 218 self.tag_entries = config.get(self.name, 'tag-entries', 'True') 192 219 … … 195 222 from config import ConfigurationError 196 223 224 Repository._validateConfiguration(self) 225 197 226 if not self.module and self.repository: 198 227 self.module = split(self.repository)[1] … … 204 233 205 234 class CvspsRepository(CvsRepository): 206 CVSPS_CMD = 'cvsps' 235 def command(self, *args, **kwargs): 236 if kwargs.get('cvsps', False): 237 kwargs['executable'] = self.__cvsps 238 return CvsRepository.command(self, *args, **kwargs) 207 239 208 240 def _load(self, config): 209 241 CvsRepository._load(self, config) 210 self. CVSPS_CMD = config.get(self.name, 'cvsps-command', self.CVSPS_CMD)242 self.__cvsps = config.get(self.name, 'cvsps-command', 'cvsps') 211 243 self.tag_entries = config.get(self.name, 'tag-entries', 'True') 212 244 … … 214 246 class DarcsRepository(Repository): 215 247 METADIR = '_darcs' 216 DARCS_CMD = 'darcs' 217 218 def _load(self, config): 219 Repository._load(self, config) 220 self.DARCS_CMD = config.get(self.name, 'darcs-command', self.DARCS_CMD) 248 249 def _load(self, config): 250 Repository._load(self, config) 251 self.EXECUTABLE = config.get(self.name, 'darcs-command', 'darcs') 221 252 222 253 223 254 class HgRepository(Repository): 224 255 METADIR = '.hg' 225 HG_CMD = "hg" 226 227 def _load(self, config): 228 Repository._load(self, config) 229 self.HG_CMD = config.get(self.name, 'hg-command', self.HG_CMD) 256 257 def _load(self, config): 258 Repository._load(self, config) 259 self.EXECUTABLE = config.get(self.name, 'hg-command', 'hg') 230 260 231 261 232 262 class MonotoneRepository(Repository): 233 263 METADIR = 'MT' 234 MONOTONE_CMD = "monotone" 235 236 def _load(self, config): 237 Repository._load(self, config) 238 self.MONOTONE_CMD = config.get(self.name, 239 'monotone-command', self.MONOTONE_CMD) 264 265 def _load(self, config): 266 Repository._load(self, config) 267 self.EXECUTABLE = config.get(self.name, 'monotone-command', 'monotone') 240 268 self.keyid = config.get(self.name, 'keyid') 241 269 self.passphrase = config.get(self.name, 'passphrase') … … 245 273 class SvnRepository(Repository): 246 274 METADIR = '.svn' 247 SVN_CMD = "svn" 248 SVNADMIN_CMD = "svnadmin" 249 250 def _load(self, config): 251 Repository._load(self, config) 252 self.SVN_CMD = config.get(self.name, 'svn-command', self.SVN_CMD) 253 self.SVNADMIN_CMD = config.get(self.name, 254 'svnadmin-command', self.SVNADMIN_CMD) 275 276 def command(self, *args, **kwargs): 277 if kwargs.get('svnadmin', False): 278 kwargs['executable'] = self.__svnadmin 279 return Repository.command(self, *args, **kwargs) 280 281 def _load(self, config): 282 Repository._load(self, config) 283 self.EXECUTABLE = config.get(self.name, 'svn-command', 'svn') 284 self.__svnadmin = config.get(self.name, 'svnadmin-command', 'svnadmin') 255 285 self.use_propset = config.get(self.name, 'use-propset', False) 256 286 257 287 def _validateConfiguration(self): 258 288 from vcpx.config import ConfigurationError 289 290 Repository._validateConfiguration(self) 259 291 260 292 if not self.repository: … … 281 313 282 314 def _validateConfiguration(self): 315 Repository._validateConfiguration(self) 316 283 317 if self.module and self.module.startswith('/'): 284 318 self.project.log_info("Removing starting '/' from module") … … 289 323 class TlaRepository(Repository): 290 324 METADIR = '{arch}' 291 TLA_CMD = "tla" 292 293 def _load(self, config): 294 Repository._load(self, config) 295 self.TLA_CMD = config.get(self.name, 'tla-command', self.TLA_CMD) 325 326 def _load(self, config): 327 Repository._load(self, config) 328 self.EXECUTABLE = config.get(self.name, 'tla-command', 'tla') 296 329 self.IGNORE_IDS = config.get(self.name, 'ignore-ids', False) 297 330 if self.IGNORE_IDS: -
vcpx/arx.py
r671 r777 26 26 """ 27 27 28 cmd = [self.repository.ARX_CMD, "add"]28 cmd = self.repository.command("add") 29 29 ExternalCommand(cwd=self.basedir, command=cmd).execute(names) 30 30 … … 45 45 logmessage.append(changelog.replace('%', '%%').encode(encoding)) 46 46 47 cmd = [self.repository.ARX_CMD,"commit", "-s", '\n'.join(logmessage),48 "--author", author,49 "--date", date.isoformat()]47 cmd = self.repository.command("commit", "-s", '\n'.join(logmessage), 48 "--author", author, 49 "--date", date.isoformat()) 50 50 c = ExternalCommand(cwd=self.basedir, command=cmd) 51 51 c.execute() … … 60 60 """ 61 61 62 cmd = [self.repository.ARX_CMD, "rm"]62 cmd = self.repository.command("rm") 63 63 ExternalCommand(cwd=self.basedir, command=cmd).execute(names) 64 64 … … 68 68 """ 69 69 70 cmd = [self.repository.ARX_CMD, "copy"]70 cmd = self.repository.command("copy") 71 71 rename = ExternalCommand(cwd=self.basedir, command=cmd) 72 72 rename.execute(oldname, newname) -
vcpx/tla.py
r708 r777 70 70 self.repository.module]) 71 71 c = ExternalCommand(cwd=self.basedir, 72 command= [self.repository.TLA_CMD, "missing", "-f"])72 command=self.repository.command("missing", "-f")) 73 73 out, err = c.execute(stdout=PIPE, stderr=PIPE) 74 74 if c.exit_status: … … 125 125 if not os.path.exists(root): 126 126 os.makedirs(root) 127 c = ExternalCommand(cwd=root, 128 command=[self.repository.TLA_CMD, "get", 129 "--no-pristine", fqrev, destdir]) 127 cmd = self.repository.command("get", "--no-pristine", fqrev, destdir) 128 c = ExternalCommand(cwd=root, command=cmd) 130 129 out, err = c.execute(stdout=PIPE, stderr=PIPE) 131 130 if c.exit_status: … … 136 135 def __apply_changeset(self, changeset): 137 136 c = ExternalCommand(cwd=self.basedir, 138 command= [self.repository.TLA_CMD, "replay"])137 command=self.repository.command("replay")) 139 138 out, err = c.execute(changeset.revision, stdout=PIPE, stderr=PIPE) 140 139 if not c.exit_status in [0, 1]: … … 151 150 path = path[2:] 152 151 if path.find("\(") != -1: 153 c = ExternalCommand(command=[self.repository.TLA_CMD, "escape",154 "--unescaped", path])152 cmd = self.repository.command("escape", "--unescaped", path) 153 c = ExternalCommand(command=cmd) 155 154 out, err = c.execute(stdout=PIPE, stderr=PIPE) 156 155 if c.exit_status: … … 165 164 self.repository.module]) 166 165 if revision in ['HEAD', 'INITIAL']: 167 cmd = [self.repository.TLA_CMD, "revisions"]166 cmd = self.repository.command("revisions") 168 167 if revision == 'HEAD': 169 168 cmd.append("-r") … … 182 181 logparser = Parser() 183 182 c = ExternalCommand(cwd=self.basedir, 184 command=[self.repository.TLA_CMD, 185 "cat-archive-log"]) 183 command=self.repository.command("cat-archive-log")) 186 184 for fqrev in fqrevlist: 187 185 out, err = c.execute(fqrev, stdout=PIPE, stderr=PIPE) … … 219 217 def __hide_foreign_entries(self): 220 218 c = ExternalCommand(cwd=self.basedir, 221 command=[self.repository.TLA_CMD, 222 "tree-lint", "-tu"]) 219 command=self.repository.command("tree-lint", "-tu")) 223 220 out = c.execute(stdout=PIPE)[0] 224 221 tempdir = None -
vcpx/cg.py
r752 r777 32 32 notdirs = [n for n in names if not isdir(join(self.basedir, n))] 33 33 if notdirs: 34 cmd = [self.repository.CG_CMD, "add"]34 cmd = self.repository.command("add") 35 35 ExternalCommand(cwd=self.basedir, command=cmd).execute(notdirs) 36 36 … … 83 83 # '-f' flag means we can get empty commits, which 84 84 # shouldn't be a problem. 85 cmd = [self.repository.CG_CMD, "commit", "-f"]85 cmd = self.repository.command("commit", "-f") 86 86 c = ExternalCommand(cwd=self.basedir, command=cmd) 87 87 … … 102 102 notdirs = [n for n in names if not isdir(join(self.basedir, n))] 103 103 if notdirs: 104 cmd = [self.repository.CG_CMD, "rm"]104 cmd = self.repository.command("rm") 105 105 c=ExternalCommand(cwd=self.basedir, command=cmd) 106 106 c.execute(notdirs) … … 144 144 145 145 if not exists(join(self.basedir, self.repository.METADIR)): 146 init = ExternalCommand(cwd=self.basedir, 147 command=[self.repository.CG_CMD, 148 "init", "-I"]) 146 cmd = self.repository.command("init", "-I") 147 init = ExternalCommand(cwd=self.basedir, command=cmd) 149 148 init.execute() 150 149 -
vcpx/baz.py
r708 r777 72 72 self.repository.module]) 73 73 c = ExternalCommand(cwd=self.basedir, 74 command= [self.repository.BAZ_CMD, "missing", "-f"])74 command=self.repository.command("missing", "-f")) 75 75 out, err = c.execute(stdout=PIPE, stderr=PIPE) 76 76 if c.exit_status: … … 91 91 try: 92 92 c = ExternalCommand(cwd=self.basedir, 93 command= [self.repository.BAZ_CMD, "replay"])93 command=self.repository.command("replay")) 94 94 out, err = c.execute(changeset.revision, stdout=PIPE, stderr=PIPE) 95 95 if not c.exit_status in [0, 1]: … … 113 113 tempdir = mkdtemp("", ",,tailor-", self.basedir) 114 114 try: 115 cmd = self.repository.command("get", "--no-pristine", fqrev, "t") 115 116 c = ExternalCommand(cwd=os.path.join(self.basedir, tempdir), 116 command=[self.repository.BAZ_CMD, "get", 117 "--no-pristine", fqrev, "t"]) 117 command=cmd) 118 118 out, err = c.execute(stdout=PIPE, stderr=PIPE) 119 119 if c.exit_status: … … 144 144 path = path[2:] 145 145 if path.find("\(") != -1: 146 c = ExternalCommand(command=[self.repository.BAZ_CMD, "escape",147 "--unescaped", path])146 cmd = self.repository.command("escape", "--unescaped", path) 147 c = ExternalCommand(command=cmd) 148 148 out, err = c.execute(stdout=PIPE, stderr=PIPE) 149 149 if c.exit_status: … … 158 158 self.repository.module]) 159 159 if revision in ['HEAD', 'INITIAL']: 160 cmd = [self.repository.BAZ_CMD, "revisions"]160 cmd = self.repository.command("revisions") 161 161 if revision == 'HEAD': 162 162 cmd.append("-r") … … 175 175 logparser = Parser() 176 176 c = ExternalCommand(cwd=self.basedir, 177 command=[self.repository.BAZ_CMD, 178 "cat-archive-log"]) 177 command=self.repository.command("cat-archive-log")) 179 178 for fqrev in fqrevlist: 180 179 out, err = c.execute(fqrev, stdout=PIPE, stderr=PIPE) … … 212 211 def __hide_foreign_entries(self): 213 212 c = ExternalCommand(cwd=self.basedir, 214 command=[self.repository.BAZ_CMD, 215 "lint", "-tu"]) 213 command=self.repository.command("lint", "-tu")) 216 214 out = c.execute(stdout=PIPE) 217 215 tempdir = None
Note: See TracChangeset
for help on using the changeset viewer.
