summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6288e3e)
raw | patch | inline | side by side (parent: 6288e3e)
author | Jonathan Nieder <jrnieder@gmail.com> | |
Sat, 20 Nov 2010 19:25:28 +0000 (13:25 -0600) | ||
committer | Jonathan Nieder <jrnieder@gmail.com> | |
Mon, 7 Mar 2011 06:56:50 +0000 (00:56 -0600) |
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>
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>
vcs-svn/repo_tree.c | patch | blob | history | |
vcs-svn/repo_tree.h | patch | blob | history |
diff --git a/vcs-svn/repo_tree.c b/vcs-svn/repo_tree.c
index 491f0135a798f518fe2d226c9d01af90e6dac736..8763de5c29f45105b6a32a39e0d0da918a2cf4f0 100644 (file)
--- a/vcs-svn/repo_tree.c
+++ b/vcs-svn/repo_tree.c
return dir_pointer(new_o);
}
-static struct repo_dirent *repo_read_dirent(uint32_t revision, uint32_t *path)
+static struct repo_dirent *repo_read_dirent(uint32_t revision,
+ const uint32_t *path)
{
uint32_t name = 0;
struct repo_dirent *key = dent_pointer(dent_alloc(1));
dent_remove(&dir_pointer(parent_dir_o)->entries, dent);
}
+uint32_t repo_read_path(const uint32_t *path)
+{
+ uint32_t content_offset = 0;
+ struct repo_dirent *dent = repo_read_dirent(active_commit, path);
+ if (dent != NULL)
+ content_offset = dent->content_offset;
+ return content_offset;
+}
+
uint32_t repo_copy(uint32_t revision, uint32_t *src, uint32_t *dst)
{
uint32_t mode = 0, content_offset = 0;
diff --git a/vcs-svn/repo_tree.h b/vcs-svn/repo_tree.h
index 68baeb582ff0ad8700061a78947cd186ff116536..3202bbeffeefa4b809422fd2ab8c36fc85838a20 100644 (file)
--- a/vcs-svn/repo_tree.h
+++ b/vcs-svn/repo_tree.h
uint32_t repo_copy(uint32_t revision, uint32_t *src, uint32_t *dst);
void repo_add(uint32_t *path, uint32_t mode, uint32_t blob_mark);
uint32_t repo_modify_path(uint32_t *path, uint32_t mode, uint32_t blob_mark);
+uint32_t repo_read_path(const uint32_t *path);
void repo_delete(uint32_t *path);
void repo_commit(uint32_t revision, uint32_t author, char *log, uint32_t uuid,
uint32_t url, long unsigned timestamp);