Changeset 296 in tailor
- Timestamp:
- 05/10/05 11:47:07 (8 years ago)
- Hash name:
- 20050510094707-ff256-0a3d206aa9a7826918def462dff861a1b3bedd6b
- File:
-
- 1 edited
-
vcpx/monotone.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
vcpx/monotone.py
r291 r296 18 18 19 19 class MonotoneCommit(SystemCommand): 20 COMMAND = " MONOTONE_AUTHOR=\"%(key)s\" monotone commit --date=\"%(date)s\" %(entries)s"20 COMMAND = "monotone commit --author=\"%(key)s\" --date=\"%(date)s\"" 21 21 22 22 def __call__(self, output=None, dry_run=False, **kwargs): 23 24 from os.path import exists, join 25 26 if not exists(join(self.working_dir, 'MT')): 27 # If MonotoneCommit is called outside the working copy 28 # (i.e. there is no MT directory) we test if we are given 29 # only the subdir as entry to commit. In that case, switch 30 # to root/subdir as working directory and issue a commit 31 # without any entries. 32 33 entries = kwargs['entries'] 34 entries = entries.replace(' ', '') 35 entries = entries.strip('\"') 36 if (exists(join(self.working_dir, entries))): 37 self.working_dir = join(self.working_dir, entries) 38 kwargs['entries'] = "" 39 else: 40 raise TargetInitializationFailure("not a valid monotone working copy (MT directory is missing in %s)" % self.working_dir) 41 23 42 log = open(self.working_dir + "/MT/log", "w"); 24 43 … … 40 59 41 60 42 class MonotoneWorkingDir( UpdatableSourceWorkingDir,SyncronizableTargetWorkingDir):61 class MonotoneWorkingDir(SyncronizableTargetWorkingDir): 43 62 44 63 ## SyncronizableTargetWorkingDir … … 63 82 else: 64 83 entries = '.' 65 66 c(key=author, logmessage=changelog, date=date, entries=entries)67 84 85 # monotone doesn't like empty changelogs ... 86 if changelog == None or len(changelog)<1: 87 if len(remark)>0: 88 changelog = remark 89 else: 90 changelog = "**** empty log message ****" 91 changelog = changelog.replace('"', '\\"') 92 93 # monotone date must be expressed as ISO8601 94 outstr = c(output=True, key=author, logmessage=changelog, 95 date=date.isoformat(), entries=entries) 96 97 # monotone complaints if there are no changes from the last commit. 98 # we ignore those errors ... 68 99 if c.exit_status: 69 raise TargetInitializationFailure( 70 "'monotone commit returned %s" % c.exit_status) 100 if outstr.getvalue().find("monotone: misuse: no changes to commit") == -1: 101 outstr.close() 102 raise TargetInitializationFailure( 103 "'monotone commit returned %s" % c.exit_status) 104 outstr.close() 71 105 72 106 def _removePathnames(self, root, names): … … 88 122 def _initializeWorkingDir(self, root, repository, module, subdir): 89 123 """ 90 Execute `monotone setup`. 124 Setup the monotone working copy 125 126 The user must setup a monotone working directory himself. Then 127 we simply use 'monotone commit', without having to specify a database 128 file or branch. Monotone looks up the database and branch in it's MT 129 directory. 91 130 """ 92 131 93 from os.path import join132 from os.path import exists, join 94 133 95 c = SystemCommand(working_dir=root, command="monotone setup .")96 c(output=True)134 if not exists(join(root, subdir, 'MT')): 135 raise TargetInitializationFailure("Please setup %s as a monotone working directory." % root) 97 136 98 if c.exit_status: 99 raise TargetInitializationFailure( 100 "'monotone setup' returned status %s" % c.exit_status) 101 102 c = SystemCommand(working_dir=root, 137 c = SystemCommand(working_dir=join(root, subdir), 103 138 command="monotone add %(names)s") 104 c(names= shrepr(subdir))139 c(names='.')
Note: See TracChangeset
for help on using the changeset viewer.
