[PATCH] blackbox test for revert in subdir
John Arbash Meinel
john at arbash-meinel.com
Tue Jan 24 16:22:31 GMT 2006
Aaron Bentley wrote:
> John Arbash Meinel wrote:
>
>>>Do you have it as a branch, or just the patch?
>
>
> I haven't committed it, because work on making merge internals private
> was still pending. Just apply the patch.
>
Done, revno 1510.
>
>>>>What you've entered there is broken. Say you do 'bzr revert foo' in
>>>>your project root. "foo" will be the result of
>>>>WorkingTree.open_containing(list[0])[1].
>>>>
>>>>So fullpath will be "foofoo".
>>>
>>>
>>>Well, that's why I said "pseudocode". We would have to handle when it is
>>>a directory (so we want the full path), versus when it is a file (when
>>>we need to take the dirname()). And besides, we would always use
>>>pathjoin() anyway,.
>
>
> But what I mean is, the output of open_containing[1] is the
> tree-relative path of the input. It is exactly what you would get if
> you did WorkingTree.relpath(list[0]).
>
> There is nothing special about relpath(list[0]) that would make it
> sensible to combine it with list[0], list[1], etc.
> pathjoin(wt.relpath(list[0]). wt.relpath(list[0])) just doesn't make
> sense, even in combination with dirname.
>
You're right. My bad.
>
>>>>Yes, it would probably be best to accept a cwd argument in
>>>>WorkingTree.relpath, but tree_files is meant to be called very early,
>>>>before any cwd fun takes place.
>
>
>>>Yes, tree_files is. But is WorkingTree.relpath()? Right now it *has* to
>>>be called early. Unless you supply an absolute path. But that is a
>>>dangerous distinction in my mind.
>>>I would rather have 'relpath' always take absolute paths, and we just
>>>make all callers ensure that they have an absolute path ahead of time.
>
>
> Since I don't see a use case for changing the cwd, I'd consider
> forbidding* that, instead. Less hassle in the general case.
>
> I considered absolutizing the user input automatically, but it can be
> useful to have the exact text the user entered.
>
> Aaron
> * of course, if someone must change cwd, they must do it carefully.
I'll give you that. I guess the fact that the test suite does it all the
time made me concerned. But this:
grep -rnI "chdir" . | grep -v "tests"
Says that we have no chdir() calls inside bzrlib. Which is a positive
thing in my mind.
What about adding a test in "test_source.py" which makes sure we never
use os.chdir() in anything other than the test suite?
John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060124/bcac04c9/attachment.pgp
More information about the bazaar
mailing list