# # patch "commands.cc" # from [35ef96802f733869fc2abdf4b88c57876e71aaf6] # to [6a8057ff80970b10eb8804299985acf9a8b8af69] # # patch "git_export.cc" # from [0ffa8d709893776efdaa0cff76502124c12becc8] # to [3798e1e682581911b49e3c867124bf2c91017bc5] # # patch "git_export.hh" # from [fd0758378a732917218f9885a46322bde6984b04] # to [a53d5d2c3ffd4faed7ed24763fa7758a15bd7860] # ======================================================================== --- commands.cc 35ef96802f733869fc2abdf4b88c57876e71aaf6 +++ commands.cc 6a8057ff80970b10eb8804299985acf9a8b8af69 @@ -3461,22 +3461,32 @@ CMD(git, N_("git"), N_("import GITREPO\n" - "export GITREPO"), + "export GITREPO [HEADNAME]"), N_("import/export from/to a GIT repository; can handle incremental\n" "importing/exporting and exporting back to a repository you\n" "previously imported from"), OPT_BRANCH_NAME) { - if (args.size() != 2) + if (args.size() < 2) throw usage(name); vector::const_iterator i = args.begin(); ++i; vector removed (i, args.end()); if (idx(args, 0)() == "import") - import_git_repo(system_path(idx(removed, 0)), app); + { + if (args.size() > 2) + throw usage(name); + import_git_repo(system_path(idx(removed, 0)), app); + } else if (idx(args, 0)() == "export") - export_git_repo(system_path(idx(removed, 0)), app); + { + if (args.size() > 3) + throw usage(name); + export_git_repo(system_path(idx(removed, 0)), + args.size() == 3 ? idx(removed, 1) : "", + app); + } else throw usage(name); } ======================================================================== --- git_export.cc 0ffa8d709893776efdaa0cff76502124c12becc8 +++ git_export.cc 3798e1e682581911b49e3c867124bf2c91017bc5 @@ -486,6 +486,7 @@ void export_git_repo(system_path const & gitrepo, + string const &headname, app_state & app) { require_path_is_directory(gitrepo, @@ -502,7 +503,9 @@ git_history git; git.branch = app.branch_name(); - system_path headpath(gitrepo / "refs/heads/mtexport"); + if (headname.empty()) + headname = "mtexport"; + system_path headpath(gitrepo / "refs/heads" / headname); // Nothing shall disturb us! transaction_guard guard(app.db); @@ -528,7 +531,7 @@ } catch (std::exception &e) { - N(false, "head mtexport is not subset of our tree; perhaps import first?"); + N(false, F("head %s is not subset of our tree; perhaps import first?") % headname); } } ======================================================================== --- git_export.hh fd0758378a732917218f9885a46322bde6984b04 +++ git_export.hh a53d5d2c3ffd4faed7ed24763fa7758a15bd7860 @@ -9,6 +9,7 @@ #include "vocab.hh" #include "database.hh" -void export_git_repo(system_path const & gitrepo, app_state & app); +void export_git_repo(system_path const & gitrepo, string const & headname, + app_state & app); #endif // __GIT_EXPORT_HH__