Changeset 1201 in tailor
- Timestamp:
- 06/30/06 06:42:29 (7 years ago)
- Hash name:
- 20060630044229-d6905-b193f45b29ad58be18cd933f53c7ab320ee5e752
- File:
-
- 1 edited
-
vcpx/repository/bzr.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
vcpx/repository/bzr.py
r1196 r1201 20 20 del version_info 21 21 22 from bzrlib.osutils import normpath 22 from bzrlib.osutils import normpath, pathjoin 23 23 from bzrlib.bzrdir import BzrDir 24 24 from bzrlib.delta import compare_trees 25 from bzrlib.add import smart_add_tree 25 26 from bzrlib import errors 26 27 … … 155 156 156 157 def _addPathnames(self, names): 157 """ 158 Add new files to working tree. 159 160 This method may get invoked several times with the same files. 161 Bzrlib complains if you try to add a file which is already 162 versioned. This method filters these out. A file might already been 163 marked to be added in this changeset, or might be a target in a rename 164 operation. Remove those too. 165 166 This method does not catch any errors from the adding through bzrlib, 167 since they are **real** errors. 168 """ 169 last_revision = self._working_tree.branch.last_revision() 170 if last_revision is None: 171 # initial revision 172 fnames = names 173 else: 174 fnames = [] 175 basis_tree = self._working_tree.branch.basis_tree() 176 inv = basis_tree.inventory 177 diff = compare_trees(basis_tree, self._working_tree) 178 added = ([new[0] for new in diff.added] + 179 [renamed[1] for renamed in diff.renamed]) 180 181 def parent_was_copied(n): 182 for p in added: 183 if n.startswith(p+'/'): 184 return True 185 return False 186 187 for fn in names: 188 normfn = normpath(fn) 189 if (not inv.has_filename(fn) 190 and not normfn in added 191 and not parent_was_copied(normfn)): 192 fnames.append(fn) 193 else: 194 self.log.debug('"%s" already in inventory, skipping', fn) 195 196 if len(fnames): 197 self.log.info('Adding %s...', ', '.join(fnames)) 198 self._working_tree.add(fnames) 158 if len(names): 159 names = [ pathjoin(self.basedir, n) for n in names ] 160 smart_add_tree(self._working_tree, names, recurse=False) 161 162 def _addSubtree(self, subdir): 163 subdir = pathjoin(self.basedir, subdir) 164 added, ignored = smart_add_tree(self._working_tree, [subdir], recurse=True) 165 166 if len(ignored): 167 f = [] 168 map(f.extend, ignored.values()) 169 self._addPathnames(f) 199 170 200 171 def _commit(self, date, author, patchname, changelog=None, entries=None):
Note: See TracChangeset
for help on using the changeset viewer.
