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

Function mainEntryClickHouseGitImport

programs/git-import/git-import.cpp:1187–1235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1185}
1186
1187int mainEntryClickHouseGitImport(int argc, char ** argv)
1188try
1189{
1190 using namespace DB;
1191
1192 po::options_description desc("Allowed options", getTerminalWidth());
1193 desc.add_options()
1194 ("help,h", "produce help message")
1195 ("skip-commits-without-parents", po::value<bool>()->default_value(true),
1196 "Skip commits without parents (except the initial commit)."
1197 " These commits are usually erroneous but they can make sense in very rare cases.")
1198 ("skip-commits-with-duplicate-diffs", po::value<bool>()->default_value(true),
1199 "Skip commits with duplicate diffs."
1200 " These commits are usually results of cherry-pick or merge after rebase.")
1201 ("skip-commit", po::value<std::vector<std::string>>(),
1202 "Skip commit with specified hash. The option can be specified multiple times.")
1203 ("skip-paths", po::value<std::string>(),
1204 "Skip paths that matches regular expression (re2 syntax).")
1205 ("skip-commits-with-messages", po::value<std::string>(),
1206 "Skip commits whose messages matches regular expression (re2 syntax).")
1207 ("diff-size-limit", po::value<size_t>()->default_value(100000),
1208 "Skip commits whose diff size (number of added + removed lines) is larger than specified threshold. Does not apply for initial commit.")
1209 ("stop-after-commit", po::value<std::string>(),
1210 "Stop processing after specified commit hash.")
1211 ("threads", po::value<size_t>()->default_value(std::thread::hardware_concurrency()),
1212 "Number of concurrent git subprocesses to spawn")
1213 ;
1214
1215 po::variables_map options;
1216 po::store(boost::program_options::parse_command_line(argc, argv, desc), options);
1217
1218 if (options.count("help"))
1219 {
1220 std::cout << documentation << '\n'
1221 << "Usage: " << argv[0] << '\n'
1222 << desc << '\n'
1223 << "\nExample:\n"
1224 << "\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";
1225 return 1;
1226 }
1227
1228 processLog(Options(options));
1229 return 0;
1230}
1231catch (...)
1232{
1233 std::cerr << DB::getCurrentExceptionMessage(true) << '\n';
1234 throw;
1235}

Callers 1

mainFunction · 0.85

Calls 6

getTerminalWidthFunction · 0.85
storeFunction · 0.85
processLogFunction · 0.85
OptionsClass · 0.70
countMethod · 0.45

Tested by

no test coverage detected