Please sign in to comment.
vcs-svn/svndump: rewrite handle_node(), begin|end_revision()
Split the decision of what to do and actually doing it in handle_node() to allow for detection of branches from svn nodes. Split it into handle_node() and apply_node(). svn dumps are structured in revisions, which contain multiple nodes. Nodes represent operations on data. Currently the function handle_node() strongly mixes the interpretation of the node data with the output of processed data to fast-import. In a fast-import stream a commit object requires a branch name to which the new commit is added at its beginning. We want to detect branches in svn. This can only be done by analyzing node operations, like copyfrom. This conflicts with the current implementation, where at the beginning of each new revision in the svn dump, a new commit on a hard-coded git branch is created, before even reading the first node. To allow analyzing the nodes before deciding on which branch the commit will be placed, store the node metadata of one complete revision, and create a commit from it, when it ends. Each node can have file data appended. It's desirable to not store the actual file data, as it is unbounded. fast-import has a 'blob' command that allows writing blobs, independent of commits. Use this feature instead of sending data inline and send the actual file data immediately when it is read in. Use the previously added SHA-1 calculation feature of fast_export_data and fast_export_blob_delta to retrieve the object name of the written blob and reference it later. fast-import's marks can not be used for that, because they are already used for marking commits, where the mark number corresponds to exactly one svn revision. Change handle_node() to interpret the node data, store it in a node_ctx, send blobs to fast-import, and append the new node_ctx to the list of node_ctx. Do this until the end of a revision. Just clear the list of note_ctx in begin_revision(). At end_revision() all node metadata is available in the node_ctx list. Future's branch detectors can decide what branches are to be changed. Then, call apply_node() for each of them to actually create a commit and change/add/delete files according to the node_ctx using the already added blobs. This can also be used to create commits if the node metadata does not come from a svndump, but is stored in e.g. notes, for later branch detection. Signed-off-by: Florian Achleitner <firstname.lastname@example.org> Signed-off-by: Junio C Hamano <email@example.com>
- Loading branch information...