# # # patch "cmd_othervcs.cc" # from [fef4c53eda8394b0a66e055218d2d30b5c9ac26d] # to [40a36e33b7d2bdce91b1d72d99b3ad0d81d4f31c] # # patch "git_export.cc" # from [1c7beda746b82bc66d7985eeeaaa296dd6134181] # to [c961539c239b9d1fa5d8ec64e52032315e77f59a] # # patch "git_export.hh" # from [7b94c6c225293d412db35c850c143bba900c6731] # to [4d57e2dfe57a171318f8821a288dcabc7a7ea1ed] # # patch "monotone.texi" # from [b078e72215488b4d23df7268b2069b69ddcd0c14] # to [a3840eaf0e4bacb1f36ecc13bf2820d0186f9308] # # patch "options_list.hh" # from [deb7b383fb3347f0f23093714f762f4ccdd32642] # to [e1c4df0d5fada430571d90934a58262c54dcc048] # ============================================================ --- cmd_othervcs.cc fef4c53eda8394b0a66e055218d2d30b5c9ac26d +++ cmd_othervcs.cc 40a36e33b7d2bdce91b1d72d99b3ad0d81d4f31c @@ -73,7 +73,8 @@ CMD(git_export, "git_export", "", CMD_RE N_("Produces a git fast-export data stream on stdout"), N_(""), options::opts::authors_file | options::opts::branches_file | - options::opts::log_revids | options::opts::log_certs | + options::opts::log_revids | options::opts::log_certs | + options::opts::use_one_changelog | options::opts::import_marks | options::opts::export_marks | options::opts::refs) { @@ -124,7 +125,8 @@ CMD(git_export, "git_export", "", CMD_RE export_changes(db, revisions, marked_revs, author_map, branch_map, change_map, - app.opts.log_revids, app.opts.log_certs); + app.opts.log_revids, app.opts.log_certs, + app.opts.use_one_changelog); if (app.opts.refs.find("revs") != app.opts.refs.end()) export_rev_refs(revisions, marked_revs); ============================================================ --- git_export.cc 1c7beda746b82bc66d7985eeeaaa296dd6134181 +++ git_export.cc c961539c239b9d1fa5d8ec64e52032315e77f59a @@ -187,7 +187,8 @@ export_changes(database & db, map const & author_map, map const & branch_map, map const & change_map, - bool log_revids, bool log_certs) + bool log_revids, bool log_certs, + bool use_one_changelog) { size_t revnum = 0; size_t revmax = revisions.size(); @@ -292,8 +293,9 @@ export_changes(database & db, // process comment certs with changelog certs - changelogs.insert(changelogs.end(), - comments.begin(), comments.end()); + if (!use_one_changelog) + changelogs.insert(changelogs.end(), + comments.begin(), comments.end()); for (cert_iterator changelog = changelogs.begin(); changelog != changelogs.end(); ++changelog) @@ -305,6 +307,8 @@ export_changes(database & db, message << value; if (value[value.size()-1] != '\n') message << "\n"; + if (use_one_changelog) + break; } } ============================================================ --- git_export.hh 7b94c6c225293d412db35c850c143bba900c6731 +++ git_export.hh 4d57e2dfe57a171318f8821a288dcabc7a7ea1ed @@ -29,7 +29,7 @@ void export_changes(database & db, std::map const & author_map, std::map const & branch_map, std::map const & change_map, - bool log_revids, bool log_certs); + bool log_revids, bool log_certs, bool use_one_changelog); void export_rev_refs(std::vector const & revisions, std::map & marked_revs); ============================================================ --- monotone.texi b078e72215488b4d23df7268b2069b69ddcd0c14 +++ monotone.texi a3840eaf0e4bacb1f36ecc13bf2820d0186f9308 @@ -9362,7 +9362,7 @@ @section GIT @ftable @command @item mtn git_export address@hidden address@hidden @itemx mtn git_export address@hidden address@hidden address@hidden mtn git_export [--log-revids] [--log-certs] address@hidden mtn git_export [--log-revids] [--log-certs] [--use-one-changelog] @itemx mtn git_export address@hidden This command exports all revisions from the current monotone database @@ -9370,11 +9370,25 @@ @section GIT fast-import. The @option{--authors-file} option may be used to map monotone author -names to different values in a manner similar to that documented in -git-svn(1). Author mappings are specified in the @var{authors-file} as: +and committer names to different values in a manner similar to that +documented in git-svn(1). Mappings are specified in the address@hidden as: @verbatim loginname = Joe User @end verbatim + +The list of authors that might need to be mapped can be extracted from +a monotone database with the following sql query: address@hidden +$ mtn db execute 'select distinct value from revision_certs where name = "author"' address@hidden verbatim + +The list of committers that might need to be mapped can be extracted +from a monotone database with the following sql query: address@hidden +$ mtn db execute 'select distinct keypair from revision_certs' where name = "author"' address@hidden verbatim + The @option{--branches-file} option may be used to map monotone branch names to different values. This may be required as monotone allows branch names that are not valid according to git. Branch mappings are @@ -9386,6 +9400,12 @@ @section GIT and the committer. These can be mapped to other values using the @var{authors-file} option. +The list of branches that might need to be mapped can be extracted +from a monotone database with using the @command{ls branches} command: address@hidden +$ mtn ls branches --ignore-suspend-certs address@hidden verbatim + The @option{--import-marks} and @option{--export-marks} options are similar to those documented in git-fast-export(1) and git-fast-import(1). These may be used for incremental exports and may @@ -9425,6 +9445,16 @@ @section GIT each of these certs and git only represents a single @code{author} and @code{date} value. +By default, the values of all changelog and comment certs on a +revision are concatenated to form the git commit message for that +revision. The @option{--use-one-changelog} option will prevent this +behaviour and use the value from the first changelog cert +encountered. @emph{WARNING:} this will explicitly lose information in +the exported data. Changelog certs have no implicit ordering, one will +be selected arbitrarily to be used as the git commit message and all +others will be excluded from the exported data. Additionally, all +comment certs will be excluded from the exported data. + References to the original monotone branches and tags are exported as @code{refs/tags/} and @code{refs/heads/}. In addition, references to the original monotone revision ids, the root ============================================================ --- options_list.hh deb7b383fb3347f0f23093714f762f4ccdd32642 +++ options_list.hh e1c4df0d5fada430571d90934a58262c54dcc048 @@ -731,6 +731,14 @@ OPTION(conflicts_opts, conflicts_file, t } #endif +OPT(use_one_changelog, "use-one-changelog", bool, false, + gettext_noop("use only one changelog cert for the git commit message")) +#ifdef option_bodies +{ + use_one_changelog = true; +} +#endif + OPT(authors_file, "authors-file", system_path, , gettext_noop("file mapping author names from original to new values")) #ifdef option_bodies