def launch_sidebyside_diff(self): """ Launch diff as a side-by-side comparison using our comparison tool """ action = GitAction( self.git, notification=False, run_in_thread=False ) if self.revision1.kind != "WORKING": dest1 = self._build_export_path(1, self.revision1, self.path1) self.save_diff_to_file(dest1, action.run_single( self.git.show, self.path1, self.revision1 )) else: dest1 = self.path1 if self.revision2.kind != "WORKING": dest2 = self._build_export_path(2, self.revision2, self.path2) self.save_diff_to_file(dest2, action.run_single( self.git.show, self.path2, self.revision2 )) else: dest2 = self.path2 rabbitvcs.util.helper.launch_diff_tool(dest1, dest2)
def on_ok_clicked(self, widget): url = self.repositories.get_active_text() path = self._get_path() if not url or not path: MessageBox( _("The repository URL and destination path are both required fields." )) return if url.startswith("file://"): url = self._parse_path(url) # Cannot do: # url = os.path.normpath(url) # ...in general, since it might be eg. an http URL. Doesn't seem to # affect pySvn though. path = os.path.normpath(path) revision = self.revision_selector.get_revision_object() self.hide() self.action = GitAction(self.git, register_gtk_quit=self.gtk_quit_is_set()) self.action.append(self.action.set_header, _("Export")) self.action.append(self.action.set_status, _("Running Export Command...")) self.action.append(rabbitvcs.util.helper.save_repository_path, url) self.action.append(self.git.export, url, path, revision=revision) self.action.append(self.action.set_status, _("Completed Export")) self.action.append(self.action.finish) self.action.start()
def on_ok_clicked(self, widget, data=None): self.hide() merge = self.get_widget("merge").get_active() repository = self.repository_selector.repository_opt.get_active_text() branch = self.repository_selector.branch_opt.get_active_text() fetch_all = self.get_widget("all").get_active() self.action = GitAction( self.git, register_gtk_quit=self.gtk_quit_is_set() ) self.action.append(self.action.set_header, _("Update")) self.action.append(self.action.set_status, _("Updating...")) if fetch_all: if merge: self.action.append(self.git.pull, "--all") else: self.action.append(self.git.fetch, "--all") else: if merge: self.action.append(self.git.pull, repository, branch) else: self.action.append(self.git.fetch, repository, branch) self.action.append(self.action.set_status, _("Completed Update")) self.action.append(self.action.finish) self.action.start()
def launch_unified_diff(self): """ Launch diff as a unified diff in a text editor or .diff viewer """ action = GitAction( self.git, notification=False, run_in_thread=False ) diff_text = action.run_single( self.git.diff, self.path1, self.revision1, self.path2, self.revision2 ) if diff_text is None: diff_text = "" fh = tempfile.mkstemp("-rabbitvcs-" + str(self.revision1)[:5] + "-" + str(self.revision2)[:5] + ".diff") os.write(fh[0], diff_text) os.close(fh[0]) rabbitvcs.util.helper.open_item(fh[1])
def pop(self): self.action = GitAction(self.git, notification=self.show, run_in_thread=False) self.action.append(self.git.stash, cmd="pop", num=None) if self.show: self.action.append(self.action.finish) self.action.schedule() self.action_refresh()
def load(self): to_rev = self.git.revision(self.get_widget("to").get_text()) self.action = GitAction(self.git, notification=False) self.action.append(self.git.annotate, self.path, to_rev) self.action.append(self.populate_table) self.action.append(self.enable_saveas) self.action.start()
def clear(self): self.selected_row = None self.action = GitAction(self.git, notification=self.show, run_in_thread=False) self.action.append(self.git.stash, cmd="clear", num=None) if self.show: self.action.append(self.action.finish) self.action.schedule() self.action_refresh()
def load(self): self.set_loading(True) # Load log. self.action = GitAction(self.git, notification=False, run_in_thread=True) self.action.append(self.refresh) self.action.schedule()
def apply(self): if len(self.revisions_table.get_selected_rows()): selected_row = self.revisions_table.get_selected_rows()[0] self.selected_row = selected_row else: selected_row = None self.action = GitAction(self.git, notification=self.show, run_in_thread=False) self.action.append(self.git.stash, cmd="apply", num=selected_row) if self.show: self.action.append(self.action.finish) self.action.schedule() self.action_refresh()
def stash(self): msg = self.message.get_text() if self.message.get_text() == "": msg = None self.action = GitAction(self.git, notification=self.show, run_in_thread=False) self.action.append(self.git.stash, cmd="save", msg=msg) if self.show: self.action.append(self.action.finish) self.action.schedule() self.action_refresh() self.message.set_text("")
def __init__(self, path): self.vcs = rabbitvcs.vcs.VCS() self.git = self.vcs.git() self.path = path self.action = GitAction(self.git, register_gtk_quit=True) self.action.append(self.action.set_header, _("Initialize Repository")) self.action.append(self.action.set_status, _("Setting up repository...")) self.action.append(self.git.initialize_repository, self.path) self.action.append(self.action.set_status, _("Completed repository setup")) self.action.append(self.action.finish) self.action.schedule()
def load(self, revision): self.launch_loading() self.action = GitAction(self.git, notification=False) self.action.append(self.git.annotate, self.path, self.git.revision(revision)) if not self.log_by_order: self.action.append(self.git.log, self.path) self.action.append(self.set_log) self.action.append(self.populate_table) self.action.append(self.enable_saveas) self.action.schedule() self.kill_loading()
def on_ok_clicked(self, widget, data=None): self.hide() rebase = self.get_widget("rebase").get_active() git_function_params = [] apply_changes = self.get_widget("apply_changes").get_active() repository = self.repository_selector.repository_opt.get_active_text() branch = self.repository_selector.branch_opt.get_active_text() fetch_all = self.get_widget("all").get_active() self.action = GitAction( self.git, register_gtk_quit=self.gtk_quit_is_set() ) self.action.append(self.action.set_header, _("Update")) self.action.append(self.action.set_status, _("Updating...")) if not apply_changes: if fetch_all: self.action.append(self.git.fetch, "--all") else: self.action.append(self.git.fetch, repository, branch) else: if rebase: git_function_params.append ("rebase") if fetch_all: git_function_params.append ("all") repository = "" branch = "" self.action.append(self.git.pull, repository, branch, git_function_params) self.action.append(self.action.set_status, _("Completed Update")) self.action.append(self.action.finish) self.action.start()
def __init__(self, paths): InterfaceView.__init__(self, "git-update", "Update") self.paths = paths self.vcs = rabbitvcs.vcs.VCS() self.git = self.vcs.git(paths[0]) self.git_svn = self.git.client.git_svn if self.git_svn: self.hide() self.do_gtk_quit = True self.action = GitAction(self.git, register_gtk_quit=self.gtk_quit_is_set()) self.action.append(self.action.set_header, _("Update")) self.action.append(self.action.set_status, _("Updating...")) self.action.append(self.git.git_svn_update) self.action.append(self.action.set_status, _("Completed Update")) self.action.append(self.action.finish) self.action.schedule() else: self.repository_selector = rabbitvcs.ui.widget.GitRepositorySelector( self.get_widget("repository_container"), self.git)
def action_refresh(self): self.action = GitAction(self.git, notification=False, run_in_thread=True) self.action.append(self.refresh) self.action.schedule()