Skip to content

Commit

Permalink
Merge pull request #9 from ajinkya007/Issue#14#19
Browse files Browse the repository at this point in the history
Issue#14#19 Add utility to export-to-git script to support multiple source arguments.
  • Loading branch information
ajinkya007 committed Aug 3, 2016
2 parents 505aab4 + 3bbfdf4 commit f6f265a
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions tools/export-to-git.pike
Expand Up @@ -191,10 +191,8 @@ int main(int argc, array(string) argv)
({"nopath",Getopt.NO_ARG,({"-N","--no-path"})}),
));
options += mkmapping(opt[*][0], opt[*][1]);
options->src = argv[-2];
options->dest = argv[-1];
_Server=conn->SteamObj(0);
export_to_git(OBJ(options->src), options->dest, ({ OBJ("/home") }));
export_to_git(argv, ({ OBJ("/home") }));
}

int count=0;
Expand Down Expand Up @@ -254,16 +252,20 @@ void git_create_branch(string to)
dir_check("",to);
}

void export_to_git(object from, string to, void|array(object) exclude)
void export_to_git(array(string) argv, void|array(object) exclude)
{
string complete_path;
string to = argv[-1];
git_init(to);
git_create_branch(to);
write("Commit message : sTeam export-to-git\n");
git_commit("sTeam export-to-git", to, "root", "root@localhost", 0, 1); //empty commit
for(int i =1;i<sizeof(argv)-1;i++){
options->src=argv[i];
Object from = OBJ(options->src);
if(!options->nopath) // only if paths have to be created
complete_path = dir_check(to,options->src);
git_object(from, to);
write("Commit message : sTeam export-to-git\n");
git_commit("sTeam export-to-git", to, "root", "root@localhost", 0, 1); //empty commit
sort(history->time, history);
foreach(history;; mapping doc)
{
Expand All @@ -275,6 +277,7 @@ void export_to_git(object from, string to, void|array(object) exclude)
if (author)
author_username = author->get_user_name();
string author_email = sprintf("%s@%s", author_username, _Server->get_server_name());
string hash = (string)git_commit(message, to, author->query_attribute("USER_FULLNAME"), author_email, doc->time);
string hash = (string)git_commit(message, to, author_username, author_email, doc->time);
}
}
}

0 comments on commit f6f265a

Please sign in to comment.