Merge lp:~cjwatson/brz/fastimport-fix-directory-renames into lp:brz
Status: | Needs review |
---|---|
Proposed branch: | lp:~cjwatson/brz/fastimport-fix-directory-renames |
Merge into: | lp:brz |
Diff against target: |
32 lines (+7/-6) 1 file modified
breezy/plugins/fastimport/exporter.py (+7/-6) |
To merge this branch: | bzr merge lp:~cjwatson/brz/fastimport-fix-directory-renames |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ioana Lasc (community) | Approve | ||
Breezy developers | Pending | ||
Review via email: mp+410767@code.launchpad.net |
Commit message
fastimport: Fix export of directory renames.
Description of the change
Passing `specific_
This fixes the export of https:/
NOTE: I'm not sure whether this is correct in --no-plain mode: in that case it will output rename commands both for the directory and for its contained paths. Is that correct? If not, I should adjust this further.
Unmerged revisions
- 7542. By Colin Watson
-
fastimport: Fix export of directory renames.
Passing `specific_
files=[ change. path[0] ]` to
`tree_old.iter_entries_ by_dir` yields only the entry for that path,
rather than for that path and all directory entries contained by it as
the code appeared to expect. Fix this to emit the correct rename
commands for all directory entries under the path being renamed, and fix
up subsequent delete commands to match.This fixes the export of
https://bazaar. launchpad. net/~lazr- developers/ launchpadlib/ trunk/revision/ 36.1.1,
which renames the `launchpadlib` directory to `src/launchpadlib` as well
as making various other changes. It may be relevant to
https://bugs.launchpad .net/brz/ +bug/1890216 as well, although I haven't
checked and I haven't tackled the rather larger task of writing useful
tests.
For --no-plain mode, it should indeed just emit a rename for the directory - the importer doesn't need to know about all the unchanged children.
I think that just means that you can change the condition on line 597 from:
if change.kind == ('directory', 'directory'):
to
if change.kind == ('directory', 'directory') and self.plain_format:
Iterating over the entire tree works, but is not very efficient :( Tree.list_files() is recursive by default and allows you to pass in a from_dir. Would it be possible to use that instead?
It would also be great to have a test if you can easily reproduce the situation in https:/ /bazaar. launchpad. net/~lazr- developers/ launchpadlib/ trunk/revision/ 36.1.1; this code is quite subtle so otherwise there's risk that future changes reintroduce this bug.