MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / mainEntryClickHouseGitImport

Function mainEntryClickHouseGitImport

programs/git-import/git-import.cpp:1202–1250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1200
1201int mainEntryClickHouseGitImport(int argc, char ** argv);
1202int mainEntryClickHouseGitImport(int argc, char ** argv)
1203try
1204{
1205 using namespace DB;
1206
1207 po::options_description desc = createOptionsDescription("Allowed options", getTerminalWidth());
1208 desc.add_options()
1209 ("help,h", "produce help message")
1210 ("skip-commits-without-parents", po::value<bool>()->default_value(true),
1211 "Skip commits without parents (except the initial commit)."
1212 " These commits are usually erroneous but they can make sense in very rare cases.")
1213 ("skip-commits-with-duplicate-diffs", po::value<bool>()->default_value(true),
1214 "Skip commits with duplicate diffs."
1215 " These commits are usually results of cherry-pick or merge after rebase.")
1216 ("skip-commit", po::value<std::vector<std::string>>(),
1217 "Skip commit with specified hash. The option can be specified multiple times.")
1218 ("skip-paths", po::value<std::string>(),
1219 "Skip paths that matches regular expression (re2 syntax).")
1220 ("skip-commits-with-messages", po::value<std::string>(),
1221 "Skip commits whose messages matches regular expression (re2 syntax).")
1222 ("diff-size-limit", po::value<size_t>()->default_value(100000),
1223 "Skip commits whose diff size (number of added + removed lines) is larger than specified threshold. Does not apply for initial commit.")
1224 ("stop-after-commit", po::value<std::string>(),
1225 "Stop processing after specified commit hash.")
1226 ("threads", po::value<size_t>()->default_value(std::thread::hardware_concurrency()),
1227 "Number of concurrent git subprocesses to spawn")
1228 ;
1229
1230 po::variables_map options;
1231 po::store(boost::program_options::parse_command_line(argc, argv, desc), options);
1232
1233 if (options.contains("help"))
1234 {
1235 std::cout << documentation << '\n'
1236 << "Usage: clickhouse git-import\n"
1237 << desc << '\n'
1238 << "\nExample:\n"
1239 << "\nclickhouse git-import --skip-paths 'generated\\.cpp|^(contrib|docs?|website|libs/(libcityhash|liblz4|libdivide|libvectorclass|libdouble-conversion|libcpuid|libzstd|libfarmhash|libmetrohash|libpoco|libwidechar_width))/' --skip-commits-with-messages '^Merge branch '\n";
1240 return 0;
1241 }
1242
1243 processLog(Options(options));
1244 return 0;
1245}
1246catch (...)
1247{
1248 std::cerr << DB::getCurrentExceptionMessage(true) << '\n';
1249 return DB::getCurrentExceptionCode();
1250}

Callers

nothing calls this directly

Calls 9

createOptionsDescriptionFunction · 0.85
getTerminalWidthFunction · 0.85
storeFunction · 0.85
processLogFunction · 0.85
getCurrentExceptionCodeFunction · 0.85
add_optionsMethod · 0.80
OptionsClass · 0.70
containsMethod · 0.45

Tested by

no test coverage detected