summaryrefslogtreecommitdiff
path: root/git-gui
diff options
context:
space:
mode:
authorLibravatar Shawn O. Pearce <spearce@spearce.org>2006-11-25 04:04:24 -0500
committerLibravatar Shawn O. Pearce <spearce@spearce.org>2006-11-25 04:04:24 -0500
commit84e0bf1de4fcdada4698e2bd53bafaeaea6b5cbd (patch)
tree10d85150b904bed5f4e4384cfa4c2583023856a9 /git-gui
parentgit-gui: Misc. comment and formatting cleanups. (diff)
downloadtgif-84e0bf1de4fcdada4698e2bd53bafaeaea6b5cbd.tar.xz
git-gui: Started implementation of switch_branch.
This implementation of switch_branch is not yet finished, and thus it throws a "NOT FINISHED" error rather than completing the switch. But its a rough sketch of the procedure required. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'git-gui')
-rwxr-xr-xgit-gui51
1 files changed, 50 insertions, 1 deletions
diff --git a/git-gui b/git-gui
index f52dd522c1..3845cf7168 100755
--- a/git-gui
+++ b/git-gui
@@ -1643,10 +1643,59 @@ proc populate_branch_menu {m} {
}
}
-proc switch_branch {b} {
+proc do_create_branch {} {
error "NOT IMPLEMENTED"
}
+proc do_delete_branch {} {
+ error "NOT IMPLEMENTED"
+}
+
+proc switch_branch {b} {
+ global HEAD commit_type file_states current_branch
+ global selected_commit_type ui_comm
+
+ if {![lock_index switch]} return
+
+ # -- Backup the selected branch (repository_state resets it)
+ #
+ set new_branch $current_branch
+
+ # -- Our in memory state should match the repository.
+ #
+ repository_state curType curHEAD curMERGE_HEAD
+ if {[string match amend* $commit_type]
+ && $curType eq {normal}
+ && $curHEAD eq $HEAD} {
+ } elseif {$commit_type ne $curType || $HEAD ne $curHEAD} {
+ info_popup {Last scanned state does not match repository state.
+
+Another Git program has modified this repository
+since the last scan. A rescan must be performed
+before the current branch can be changed.
+
+The rescan will be automatically started now.
+}
+ unlock_index
+ rescan {set ui_status_value {Ready.}}
+ return
+ }
+
+ # -- Toss the message buffer if we are in amend mode.
+ #
+ if {[string match amend* $curType]} {
+ $ui_comm delete 0.0 end
+ $ui_comm edit reset
+ $ui_comm edit modified false
+ }
+
+ set selected_commit_type new
+ set current_branch $new_branch
+
+ unlock_index
+ error "NOT FINISHED"
+}
+
######################################################################
##
## remote management