本文整理汇总了C++中ProjectConfiguration::git_use_remote_repository_get方法的典型用法代码示例。如果您正苦于以下问题:C++ ProjectConfiguration::git_use_remote_repository_get方法的具体用法?C++ ProjectConfiguration::git_use_remote_repository_get怎么用?C++ ProjectConfiguration::git_use_remote_repository_get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectConfiguration
的用法示例。
在下文中一共展示了ProjectConfiguration::git_use_remote_repository_get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: git_upgrade
void git_upgrade ()
// Upgrades the git system.
{
// Go through the projects that have their git repository enabled.
extern Settings * settings;
vector <ustring> projects = projects_get_all ();
for (unsigned int i = 0; i < projects.size(); i++) {
ProjectConfiguration * projectconfig = settings->projectconfig (projects[i]);
ustring git_directory = gw_build_filename (project_data_directory_project (projects[i]), ".git");
if (projectconfig->git_use_remote_repository_get()) {
// At times there's a stale index.lock file that prevents any collaboration.
// This is to be removed.
ustring index_lock = gw_build_filename (git_directory, "index.lock");
if (g_file_test (index_lock.c_str(), G_FILE_TEST_IS_REGULAR)) {
gw_message (_("Cleaning out index lock ") + index_lock);
unix_unlink (index_lock.c_str());
}
// Get the data directory for the project
ustring datadirectory = tiny_project_data_directory_project(projects[i]);
// On most machines git can determine the user's name from the system services.
// On the XO machine, it can't. It is set here manually.
// On more recent versions of git, like version 1.8.3 and younger,
// although git may determine the user's name from the system,
// it still requires it to be set manually.
ustring command;
command = "git config user.email \"";
command.append(g_get_user_name());
command.append("@");
command.append(g_get_host_name());
command.append("\"");
maintenance_register_shell_command (datadirectory, command);
command = "git config user.name \"";
command.append(g_get_real_name());
command.append("\"");
maintenance_register_shell_command (datadirectory, command);
// (Re)initialize the repository. This can be done repeatedly without harm.
// Note that this is done on shutdown.
maintenance_register_shell_command (datadirectory, "git init");
} else {
if (g_file_test (git_directory.c_str(), G_FILE_TEST_IS_DIR)) {
gw_message (_("Cleaning out folder ") + git_directory);
ProgressWindow progresswindow (_("Tidying up project ") + projects[i], false);
progresswindow.set_fraction (0.5);
unix_rmdir (git_directory);
}
}
}
}
示例2: on_assistant_prepare
void RemoteRepositoryAssistant::on_assistant_prepare (GtkWidget *page)
{
extern Settings * settings;
ProjectConfiguration *projectconfig = settings->projectconfig(bible);
if (page == checkbutton_use_repository) {
// Set all values in the GUI, according to the project configuration if it is a Bible,
// or the general configuration for project notes.
// Whether to use the remote repository.
bool use_remote_repository = false;
if (bible_notes_selector_bible ()) {
use_remote_repository = projectconfig->git_use_remote_repository_get();
} else {
use_remote_repository = settings->genconfig.consultation_notes_git_use_remote_repository_get();
}
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_use_repository), use_remote_repository);
// Set the repository location.
ustring repository_url;
if (bible_notes_selector_bible ()) {
repository_url = projectconfig->git_remote_repository_url_get();
} else {
repository_url = settings->genconfig.consultation_notes_git_remote_repository_url_get();
}
ignore_entry_repository_changed = true;
gtk_entry_set_text (GTK_ENTRY (entry_repository), repository_url.c_str());
ignore_entry_repository_changed = false;
}
if (page == label_try_git) {
// Prepare for the page to try git.
if (!git_tried_and_okay) {
git_tried_and_okay = try_git ();
if (git_tried_and_okay) {
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label_try_git, true);
}
}
}
if (page == vbox_repository) {
// Prepare for the page where the repository URL is set.
gtk_widget_grab_focus (entry_repository);
on_entry_repository();
}
if (page == vbox_clone) {
// Prepare for the page where the cloning is done.
if (repository_url_get() != previously_cloned_url) {
repository_unclone();
}
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox_clone, repository_was_cloned());
if (!repository_was_cloned()) {
gtk_label_set_text (GTK_LABEL (label_clone), "");
}
}
if (page == label_write_test) {
// Prepare for the page for testing write access.
if (!write_access_granted) {
test_write_access ();
}
}
}