Skip to content

Commit

Permalink
Merge pull request #775 from ojab/master
Browse files Browse the repository at this point in the history
Add option to enable recursion in seafile_diff()
  • Loading branch information
killing committed Dec 2, 2014
2 parents 56e51a3 + 8593163 commit b48c404
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions common/rpc-service.c
Original file line number Diff line number Diff line change
Expand Up @@ -1622,7 +1622,7 @@ get_diff_status_str(char status)
}

GList *
seafile_diff (const char *repo_id, const char *arg1, const char *arg2, GError **error)
seafile_diff (const char *repo_id, const char *arg1, const char *arg2, int fold_dir_diff, GError **error)
{
SeafRepo *repo;
char *err_msgs = NULL;
Expand All @@ -1645,7 +1645,7 @@ seafile_diff (const char *repo_id, const char *arg1, const char *arg2, GError **
return NULL;
}

diff_entries = seaf_repo_diff (repo, arg1, arg2, &err_msgs);
diff_entries = seaf_repo_diff (repo, arg1, arg2, fold_dir_diff, &err_msgs);
if (err_msgs) {
g_set_error (error, SEAFILE_DOMAIN, -1, "%s", err_msgs);
g_free (err_msgs);
Expand Down
2 changes: 1 addition & 1 deletion include/seafile-rpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ int seafile_remove_task (const char *task_id, int task_type, GError **error);
*/
GList *
seafile_diff (const char *repo_id, const char *old, const char *new,
GError **error);
int fold_dir_diff, GError **error);

GList *
seafile_branch_gets (const char *repo_id, GError **error);
Expand Down
1 change: 1 addition & 0 deletions lib/rpc_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
[ "objlist", ["string", "string"] ],
[ "objlist", ["string", "string", "string"] ],
[ "objlist", ["string", "string", "int"] ],
[ "objlist", ["string", "string", "string", "int"] ],
[ "objlist", ["string", "string", "int", "int"] ],
[ "objlist", ["int", "string", "string", "int", "int"] ],
[ "objlist", ["string", "int", "string", "string", "string"] ],
Expand Down
2 changes: 1 addition & 1 deletion python/seafile/rpcclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def seafile_destroy_repo(repo_id):
pass
remove_repo = seafile_destroy_repo

@searpc_func("objlist", ["string", "string", "string"])
@searpc_func("objlist", ["string", "string", "string", "int"])
def seafile_diff():
pass
get_diff = seafile_diff
Expand Down
4 changes: 2 additions & 2 deletions python/seaserv/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ def get_repo_size(self, repo_id):
def revert_repo(self, repo_id, commit_id, username):
return seafserv_threaded_rpc.revert_on_server(repo_id, commit_id, username)

def diff_commits(self, repo_id, old_commit, new_commit):
return seafserv_threaded_rpc.get_diff(repo_id, old_commit, new_commit)
def diff_commits(self, repo_id, old_commit, new_commit, fold_dir_diff = 1):
return seafserv_threaded_rpc.get_diff(repo_id, old_commit, new_commit, fold_dir_diff)

def get_commit_list(self, repo_id, offset, limit):
return seafserv_threaded_rpc.get_commit_list(repo_id, offset, limit)
Expand Down
2 changes: 1 addition & 1 deletion server/repo-mgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ GList *
seaf_repo_get_commits (SeafRepo *repo);

GList *
seaf_repo_diff (SeafRepo *repo, const char *arg1, const char *arg2, char **error);
seaf_repo_diff (SeafRepo *repo, const char *arg1, const char *arg2, int fold_dir_diff, char **error);

typedef struct _SeafRepoManager SeafRepoManager;
typedef struct _SeafRepoManagerPriv SeafRepoManagerPriv;
Expand Down
6 changes: 3 additions & 3 deletions server/repo-op.c
Original file line number Diff line number Diff line change
Expand Up @@ -4749,7 +4749,7 @@ get_commit(SeafRepo *repo, const char *branch_or_commit)
}

GList *
seaf_repo_diff (SeafRepo *repo, const char *old, const char *new, char **error)
seaf_repo_diff (SeafRepo *repo, const char *old, const char *new, int fold_dir_diff, char **error)
{
SeafCommit *c1 = NULL, *c2 = NULL;
int ret = 0;
Expand All @@ -4765,7 +4765,7 @@ seaf_repo_diff (SeafRepo *repo, const char *old, const char *new, char **error)

if (old == NULL || old[0] == '\0') {
if (c2->parent_id && c2->second_parent_id) {
ret = diff_merge (c2, &diff_entries, TRUE);
ret = diff_merge (c2, &diff_entries, fold_dir_diff);
if (ret < 0) {
*error = g_strdup("Failed to do diff");
seaf_commit_unref (c2);
Expand Down Expand Up @@ -4793,7 +4793,7 @@ seaf_repo_diff (SeafRepo *repo, const char *old, const char *new, char **error)
}

/* do diff */
ret = diff_commits (c1, c2, &diff_entries, TRUE);
ret = diff_commits (c1, c2, &diff_entries, fold_dir_diff);
if (ret < 0)
*error = g_strdup("Failed to do diff");

Expand Down
2 changes: 1 addition & 1 deletion server/seaf-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ static void start_rpc_service (CcnetClient *client, int cloud_mode)
searpc_server_register_function ("seafserv-threaded-rpcserver",
seafile_diff,
"seafile_diff",
searpc_signature_objlist__string_string_string());
searpc_signature_objlist__string_string_string_int());

searpc_server_register_function ("seafserv-threaded-rpcserver",
seafile_post_file,
Expand Down

0 comments on commit b48c404

Please sign in to comment.