* Adeodato Simó [Fri, 30 Jun 2006 04:37:57 +0200]:
> This patch adds yet another loop of processing to bzr's _addPathnames(),
> all because WorkingTree.add() is used to talk to bzrlib, instead of
> smart_add_tree().
[...]
> #64 would get solved with this, and I'd say it'd be possible to simplify
> a bit the preceding code too, eg. dealing with renames, since `bzr mv a
> b; bzr add b` in the command line raises no error.
Attached is a patch doing this:
[bzr] rewrite _addPathnames and _addSubtree using smart_add_tree
BzrWorkingDir._addPathnames: make 25 lines shorter by making use of
smart_add_tree, which can deal with already added or renamed files.
This fixes ticket #64, since this function also takes care of adding
missing parent directories.
BzrWorkingDir._addSubtree: reintroduce, but this time paying attention
to the return value, since it includes a list of ignored files: if any,
call self._addPathnames() on them.
> I still need to understand the issue behind changeset 1049, in order to
> make sure that I introduce no regressions, but I wouldn't be surprised
> if smart_add_tree() would handle it just fine by itself.
Well, I think I get it now, and indeed it does.
For the record, the current code can't cope with the following svn repo:
% svnadmin create svn
% svn co file://`pwd`/svn s
% cd s
% mkdir -p a/b
% touch a/b/c
% svn add a
% svn ci -m 'Added a/b/c.'
% svn cp a a2
% echo hi >a2/b/c
% svn ci -m 'cp a a2, modify a2/b/c.'
Cheers,
--
Adeodato Simó dato at net.com.org.es
Debian Developer adeodato at debian.org
Listening to: ISAN - Sat73
New patches:
[[bzr] rewrite _addPathnames and _addSubtree using smart_add_tree
Adeodato Simo <[EMAIL PROTECTED]>**20060630044229
BzrWorkingDir._addPathnames: make 25 lines shorter by making use of
smart_add_tree, which can deal with already added or renamed files.
This fixes ticket #64, since this function also takes care of adding
missing parent directories.
BzrWorkingDir._addSubtree: reintroduce, but this time paying attention
to the return value, since it includes a list of ignored files: if any,
call self._addPathnames() on them.
] {
hunk ./vcpx/repository/bzr.py 22
-from bzrlib.osutils import normpath
+from bzrlib.osutils import normpath, pathjoin
hunk ./vcpx/repository/bzr.py 25
+from bzrlib.add import smart_add_tree
hunk ./vcpx/repository/bzr.py 158
- """
- Add new files to working tree.
-
- This method may get invoked several times with the same files.
- Bzrlib complains if you try to add a file which is already
- versioned. This method filters these out. A file might already been
- marked to be added in this changeset, or might be a target in a rename
- operation. Remove those too.
-
- This method does not catch any errors from the adding through bzrlib,
- since they are **real** errors.
- """
- last_revision = self._working_tree.branch.last_revision()
- if last_revision is None:
- # initial revision
- fnames = names
- else:
- fnames = []
- basis_tree = self._working_tree.branch.basis_tree()
- inv = basis_tree.inventory
- diff = compare_trees(basis_tree, self._working_tree)
- added = ([new[0] for new in diff.added] +
- [renamed[1] for renamed in diff.renamed])
-
- def parent_was_copied(n):
- for p in added:
- if n.startswith(p+'/'):
- return True
- return False
+ if len(names):
+ names = [ pathjoin(self.basedir, n) for n in names ]
+ smart_add_tree(self._working_tree, names, recurse=False)
hunk ./vcpx/repository/bzr.py 162
- for fn in names:
- normfn = normpath(fn)
- if (not inv.has_filename(fn)
- and not normfn in added
- and not parent_was_copied(normfn)):
- fnames.append(fn)
- else:
- self.log.debug('"%s" already in inventory, skipping', fn)
+ def _addSubtree(self, subdir):
+ subdir = pathjoin(self.basedir, subdir)
+ added, ignored = smart_add_tree(self._working_tree, [subdir],
recurse=True)
hunk ./vcpx/repository/bzr.py 166
- if len(fnames):
- self.log.info('Adding %s...', ', '.join(fnames))
- self._working_tree.add(fnames)
+ if len(ignored):
+ f = []
+ map(f.extend, ignored.values())
+ self._addPathnames(f)
}
Context:
[[darcs source] don't repeat patch name in changelog
Adeodato Simo <[EMAIL PROTECTED]>**20060627173907
Make endElement's behavior consistent with that of _getUpstreamChangesets,
and don't include the patch name in the changelog, even if this one is
empty.
]
[[bzr] when removing files, get files removed before the directory they're in
Adeodato Simo <[EMAIL PROTECTED]>**20060627124651]
[[git] add support for "repository" parameter
[EMAIL PROTECTED]
[[git] make it more obvious what the parts common to source and target are
[EMAIL PROTECTED]
[Replace dashes with underscores in the hg command names
Andrea Arcangeli <[EMAIL PROTECTED]>**20060629085140]
[Added the vcpx.repository subpackage
Andrea Arcangeli <[EMAIL PROTECTED]>**20060629085111]
[Use "_editXXX" instead of "_recordUpdatedXXX" for consistency
[EMAIL PROTECTED]
[Initialize logger in repository before loading the project
[EMAIL PROTECTED]
This makes the loader available to backend-specific _load() methods.
]
[Misc parent-repo fixes and cleanups
[EMAIL PROTECTED]
Do not use a default value of '' for parent-repo. Also fix a bug introduced
while moving parent-repo support out of tailor.py.
]
[Revert change to Tailorizer.bootstrap()
[EMAIL PROTECTED]
Only git knows about PARENT_REPO at this point, so the test must
performed by the specific workingdir.
]
[Fix repository instantiation
[EMAIL PROTECTED]
Don't use the logger, since we don't have one yet. The caller
will log something for us. Moved (and tested) the bzr specific
code into the pertaining unit.
]
[Revert last change on cvs logger name
[EMAIL PROTECTED]
The name of the logger is still "tailor.vcpx.REP-KIND.xxx"
]
[Add missing InvocationError import
[EMAIL PROTECTED]
[Initial support for branches in git target
[EMAIL PROTECTED]
[Fix remaining references to path predating the repository.py split
[EMAIL PROTECTED]
[Untabified
[EMAIL PROTECTED]
[[git] commit at plumbing level
[EMAIL PROTECTED]
This avoids to call the git-commit shell script, and uses low-level git tools
to do the same job.
]
[Whitespace, two blank lines to separate classes
[EMAIL PROTECTED]
[Split the monolithic repository.py into smaller units
[EMAIL PROTECTED]
The repository subclass of each backend is now in the same unit that
implements its working dir, under the vcpx.repository subpackage.
This has several advantages: the obvious of keeping related code closer
and the ability of lazy load only the needed unit, as it was already done
for the working dir subclasses.
]
[Use a common ancestor to recognize tailor exceptions
[EMAIL PROTECTED]
[Fix comment
[EMAIL PROTECTED]
[[git] do not rely on "git-commit -a", use git-update-index
[EMAIL PROTECTED]
This is the first part of getting rid of git-commit. We explicitely
update the index for each type of file modification.
]
[Fix _tryCommand call in _getRev
[EMAIL PROTECTED]
I have not experienced the problem, but it seems clear _tryCommand is not
correctly called here.
]
[Add a hook to record updated entries in target repo
[EMAIL PROTECTED]
[Correctly display "default encoding" warning
[EMAIL PROTECTED]
[[hg] call add with no arguments on init
Brendan Cully <[EMAIL PROTECTED]>**20060621204559]
[[hg] canonify repository root directory
Brendan Cully <[EMAIL PROTECTED]>**20060621191453
The dirstate walker uses simple string comparison between repo.root
and os.getcwd(), which may fail unexpectedly if repo.root is not
the same as realpath(repo.root)
]
[[hg] chdir to self.basedir before executing commands
Brendan Cully <[EMAIL PROTECTED]>**20060621184724
Some hg tree walk operations expect to be started from the repository
root (the command-line tool always does this). Without this patch
the dirstate walk may occasionally inappropriately mangle paths,
depending on where tailor is run from.
]
[[hg] Remove files under subdirectories
Brendan Cully <[EMAIL PROTECTED]>**20060620210828
removePathnames was just ignoring directories instead of
removing the files under them. Tailor should walk mercurial's
dirstate and remove all files under a removed directory.
]
[[hg] Use high level commit command
Brendan Cully <[EMAIL PROTECTED]>**20060620203136
commands.commit takes care of expanding directories to their component
files so we don't have to (we weren't doing it correctly either). If
mercurial ever decides to track directories, this will already be
correct.
]
[[hg] wrapper for commands.*
Brendan Cully <[EMAIL PROTECTED]>**20060620190739
_hgCommand makes it easier to call commands.* functions, and
ensures they will always have their options dictionary set
correctly.
]
[[hg] always use repository-specific UI when repository is available
Brendan Cully <[EMAIL PROTECTED]>**20060620190521]
[Possible fix for #56: detect branch name at bootstrap
[EMAIL PROTECTED]
[Use normalized path for comparing with paths from bzrlib
[EMAIL PROTECTED]
This is the patch attached to ticket #59, thank you luks.
]
[M-x whitespace-cleanup
[EMAIL PROTECTED]
[Remove useless imports noticed by pyflakes
[EMAIL PROTECTED]
[Catch ConfigParser exceptions
[EMAIL PROTECTED]
[Use the new SF.NET nomenclature to reach the CVS repositories
[EMAIL PROTECTED]
[Make changeset-threshold a cvs parameter
Yann Dirson <[EMAIL PROTECTED]>**20060606072820]
[Compare the revision with branch only when following a branch
[EMAIL PROTECTED]
[Revisited generation of commit entries
[EMAIL PROTECTED]
Consider added names first, and add the old name in the abstract method.
This should fix #39 where parent dirs are committed after child, either
in very large svn commit or coming from CVS.
]
[Add fake events at the end of the loop
[EMAIL PROTECTED]
[TAG Version 0.9.23
[EMAIL PROTECTED]
Patch bundle hash:
58eef7d7199a334e9d1dee17ae49c231f55f225b
_______________________________________________
Tailor mailing list
[email protected]
http://lists.zooko.com/mailman/listinfo/tailor