Changeset 173 in tracdarcs
- Timestamp:
- 05/08/10 21:28:22 (21 months ago)
- Hash name:
- 20100508192822-97f81-b1bb7bbbea66114acc0c79d962bd856ff264cf23
- Location:
- tracdarcs
- Files:
-
- 2 edited
-
components.py (modified) (2 diffs)
-
command.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tracdarcs/components.py
r170 r173 37 37 darcs_command = Option('darcs', 'command', 'darcs', 38 38 "Name of the external darcs binary.") 39 40 max_concurrent_darcses = Option('darcs', 'max_concurrent_darcses', 'false', 41 "Max number of concurrent darcses running per repository.") 39 42 40 43 possible_encodings = Option('darcs', 'possible_encodings', 'utf-8,iso8859-1', … … 56 59 possible_encodings = [e.strip() 57 60 for e in self.possible_encodings.split(',')] 61 62 # Setup the semaphore used to limit the number of concurrent running 63 # darcs within a single repository. 64 65 if self.max_concurrent_darcses and int(self.max_concurrent_darcses)>0: 66 from command import DarcsCommand 67 if DarcsCommand.RUNNING_DARCSES is None: 68 from threading import BoundedSemaphore 69 DarcsCommand.RUNNING_DARCSES = BoundedSemaphore(value=int(self.max_concurrent_darcses)) 70 58 71 return DarcsRepository(db, dir, self.env.log, darcs, possible_encodings, params) 59 72 -
tracdarcs/command.py
r172 r173 45 45 ''' 46 46 47 RUNNING_DARCSES = None 47 48 darcs_version = None 48 49 … … 78 79 else: 79 80 command = 'TZ=UTC ' + command 80 if self.log: 81 self.log.debug(command) 82 np = NaivePopen(command, input=input, capturestderr=True) 81 82 # Respect the maximum number of running darcs limit 83 if DarcsCommand.RUNNING_DARCSES is not None: 84 if self.log: 85 self.log.debug('Asking permission to run %s ...', command) 86 DarcsCommand.RUNNING_DARCSES.acquire() 87 if self.log: 88 self.log.debug('... got permission to run %s', command) 89 else: 90 if self.log: 91 self.log.debug(command) 92 93 try: 94 np = NaivePopen(command, input=input, capturestderr=True) 95 finally: 96 if DarcsCommand.RUNNING_DARCSES is not None: 97 DarcsCommand.RUNNING_DARCSES.release() 98 83 99 if np.errorlevel: 84 100 err = 'Running (%s) failed: %s, %s: %s' % (command,
Note: See TracChangeset
for help on using the changeset viewer.