summaryrefslogtreecommitdiff
path: root/vcs-svn/repo_tree.c
AgeCommit message (Collapse)AuthorFilesLines
2011-05-26Merge branch 'db/svn-fe-code-purge' into svn-feLibravatar Jonathan Nieder1-8/+8
* db/svn-fe-code-purge: vcs-svn: drop obj_pool vcs-svn: drop treap vcs-svn: drop string_pool vcs-svn: pass paths through to fast-import Conflicts: vcs-svn/fast_export.c vcs-svn/fast_export.h vcs-svn/repo_tree.c vcs-svn/repo_tree.h vcs-svn/string_pool.c vcs-svn/svndump.c vcs-svn/trp.txt
2011-03-26vcs-svn: avoid using ls command twiceLibravatar David Barr1-20/+4
Currently there are two functions to retrieve the mode and content at a path: const char *repo_read_path(const uint32_t *path); uint32_t repo_read_mode(const uint32_t *path) Replace them with a single function with two return values. This means we can use one round-trip to get the same information from fast-import that previously took two. Signed-off-by: David Barr <david.barr@cordelta.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2011-03-22vcs-svn: pass paths through to fast-importLibravatar David Barr1-10/+10
Now that there is no internal representation of the repo, it is not necessary to tokenise paths. Use strbuf instead and bypass string_pool. This means svn-fe can handle arbitrarily long paths (as long as a strbuf can fit them), with arbitrarily many path components. While at it, since we now treat paths in their entirety, only quote when necessary. Signed-off-by: David Barr <david.barr@cordelta.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2011-03-07vcs-svn: eliminate repo_tree structureLibravatar Jonathan Nieder1-298/+37
Rely on fast-import for information about previous revs. This requires always setting up backward flow of information, even for v2 dumps. On the plus side, it simplifies the code by quite a bit and opens the door to further simplifications. [db: adjusted to support final version of the cat-blob patch] [jn: avoiding hard-coding git's name for the empty tree for portability to other backends] Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: David Barr <david.barr@cordelta.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2011-03-07vcs-svn: use higher mark numbers for blobsLibravatar Jonathan Nieder1-1/+1
Prepare to use mark :5 for the commit corresponding to r5 (and so on). 1 billion seems sufficiently high for blob marks to avoid conflicting with rev marks, while still leaving room for 3 billion blobs. Such high mark numbers cause trouble with ancient fast-import versions, but this topic cannot support git fast-import versions before 1.7.4 (which introduces the cat-blob command) anyway. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2011-03-07vcs-svn: simplify repo_modify_path and repo_copyLibravatar Jonathan Nieder1-17/+10
Restrict the repo_tree API to functions that are actually needed. - decouple reading the mode and content of dirents from other operations. - remove repo_modify_path. It is only used to read the mode from dirents. - remove the ability to use repo_read_mode on a missing path. The existing code only errors out in that case, anyway. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: David Barr <david.barr@cordelta.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2011-03-07vcs-svn: introduce repo_read_path to check the content at a pathLibravatar Jonathan Nieder1-1/+11
The repo_tree structure remembers, for each path in each revision, a mode (regular file, executable, symlink, or directory) and content (blob mark or directory structure). Maintaining a second copy of all this information when it's already in the target repository is wasteful, it does not persist between svn-fe invocations, and most importantly, there is no convenient way to transfer it from one machine to another. So it would be nice to get rid of it. As a first step, let's change the repo_tree API to match fast-import's read commands more closely. Currently to read the mode for a path, one uses repo_modify_path(path, new_mode, new_content); which changes the mode and content as a side effect. There is no function to read the content at a path; add one. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: David Barr <david.barr@cordelta.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2011-02-26Merge commit 'jn/svn-fe' of git://github.com/gitster/git into svn-feLibravatar Jonathan Nieder1-14/+7
* git://github.com/gitster/git: vcs-svn: Allow change nodes for root of tree (/) vcs-svn: Implement Prop-delta handling vcs-svn: Sharpen parsing of property lines vcs-svn: Split off function for handling of individual properties vcs-svn: Make source easier to read on small screens vcs-svn: More dump format sanity checks vcs-svn: Reject path nodes without Node-action vcs-svn: Delay read of per-path properties vcs-svn: Combine repo_replace and repo_modify functions vcs-svn: Replace = Delete + Add vcs-svn: handle_node: Handle deletion case early vcs-svn: Use mark to indicate nodes with included text vcs-svn: Unclutter handle_node by introducing have_props var vcs-svn: Eliminate node_ctx.mark global vcs-svn: Eliminate node_ctx.srcRev global vcs-svn: Check for errors from open() vcs-svn: Allow simple v3 dumps (no deltas yet) Conflicts: t/t9010-svn-fe.sh vcs-svn/svndump.c
2010-12-07vcs-svn: fix intermittent repo_tree corruptionLibravatar Jonathan Nieder1-2/+2
Pointers to directory entries do not remain valid after a call to dent_insert. Noticed in the course of importing a small Subversion repository (~1000 revs); after setting up a dirent for a certain path as a placeholder, by luck dent_insert would trigger a realloc that shifted around addresses, resulting in an import with that file replaced by a directory. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-24vcs-svn: Combine repo_replace and repo_modify functionsLibravatar Jonathan Nieder1-14/+7
There are two functions to change the staged content for a path in the svn importer's active commit: repo_replace, which changes the text and returns the mode, and repo_modify, which changes the text and mode and returns nothing. Worse, there are more subtle differences: - A mark of 0 passed to repo_modify means "use the existing content". repo_replace uses it as mark :0 and produces a corrupt stream. - When passed a path that is not part of the active commit, repo_replace returns without doing anything. repo_modify transparently adds a new directory entry. Get rid of both and introduce a new function with the best features of both: repo_modify_path modifies the mode, content, or both for a path, depending on which arguments are zero. If no such dirent already exists, it does nothing and reports the error by returning 0. Otherwise, the return value is the resulting mode. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-14vcs-svn: Rename dirent pool to build on WindowsLibravatar Jonathan Nieder1-73/+73
dirent is #defineā€™d to mingw_dirent in compat/mingw.h, with the result that obj_pool_gen(dirent, struct repo_dirent, 4096) creates functions with names like mingw_dirent_alloc and references to dirent_alloc go unresolved. Rename the functions to dent_* to avoid this problem. Reported-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-14Infrastructure to write revisions in fast-export formatLibravatar David Barr1-0/+329
repo_tree maintains the exporter's state and provides a facility to to call fast_export, which writes objects to stdout suitable for consumption by fast-import. The exported functions roughly correspond to Subversion FS operations. . repo_add, repo_modify, repo_copy, repo_replace, and repo_delete update the current commit, based roughly on the corresponding Subversion FS operation. . repo_commit calls out to fast_export to write the current commit to the fast-import stream in stdout. . repo_diff is used by the fast_export module to write the changes for a commit. . repo_reset erases the exporter's state, so valgrind can be happy. [rr: squelched compiler warnings] [jn: removed support for maintaining state on-disk, though we may want to add it back later] Signed-off-by: David Barr <david.barr@cordelta.com> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>