summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2007-07-25git-gui: Save remote urls obtained from config/remotes setupShawn O. Pearce
I'm storing the URLs of any pre-configured remote repositories that we happen to come across so that we can later use these URLs to show to the user in parts of the UI that might care. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-23git-gui: Avoid unnecessary symbolic-ref call during checkoutShawn O. Pearce
If we are checking out the branch we are already on then there is no need to call symbolic-ref to update the HEAD pointer to the "new" branch name, it is already correct. Currently this situation does not happen very often, but it can be seen in some workflows where the user always recreates their local branch from a remote tracking branch and more-or-less ignores what branch he/she is on right now. As they say, ignorance is bliss. This case will however become a tad more common when we overload checkout_op to actually also perform all of our merges. In that case we will likely see that the branch we want to "checkout" is the current branch, as we are actually just merging into it. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-23git-gui: Paper bag fix quitting crash after commitShawn O. Pearce
My earlier introduction of the GITGUI_BCK file (which saves the user's commit message buffer while they are typing it) broke the Quit function. If the user makes a commit we delete the GITGUI_BCK file; if they then immediately quit the application we fail to rename the GITGUI_BCK file to GITGUI_MSG. This is because the file does not exist, but our flag still says it does. The root cause is we did not unset the flag during commit. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-22git-gui: Fix unnecessary fast-forward during checkoutShawn O. Pearce
If we are trying to checkout a local branch which is matched to a remote tracking branch, but the local branch is newer than the remote tracking branch we actually just want to switch to the local branch. The local branch is "Already up to date". Unfortunately we tossed away the local branch's commit SHA-1 and kept the remote tracking branch's SHA-1, which meant that the user lost the local changes when we updated the working directory. At least we did not update the local branch ref, so the user's data was still intact. We now toss the tracking branch's SHA-1 and replace with the local branch's SHA-1 before the checkout, ensuring that we pass of the right tree to git-read-tree when we update the working directory. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-21git-gui: Internally allow fetch without storing for future pull supportShawn O. Pearce
This is actually just an underlying code improvement that has no user visible component yet. UI improvements to actually fetch and merge via an arbitrary remote with no tracking branches must still follow to make this change useful for the end-user. Our tracking branch specifications are a Tcl list of three components: - local tracking branch name - remote name/url - remote branch name/tag name This change just makes the first element optional. If it is an empty string we will run the fetch, but have the value be saved only into the special .git/FETCH_HEAD, where we can pick it up and use it for this one time operation. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-21git-gui: Skip unnecessary read-tree work during checkoutShawn O. Pearce
I totally missed this obvious optimization in the checkout code path. If our current repository HEAD is actually at the commit we are moving to, and we agreed to perform this switch earlier, then we have no files to update in the working directory and any stale mtimes are simply not of consequence right now. We can pretend like we ran a read-tree and skip right into the post-read-tree work, such as updating the branch and setting the symbolic-ref. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-21git-gui: Simplify error case for unsupported merge typesShawn O. Pearce
If we are given a merge type we don't understand in checkout_op there is probably a bug in git-gui somewhere that allowed this unknown merge strategy to come into this part of the code path. We currently only recognize three merge types ('none', 'ff' and 'reset') but are going to be supporting more in the future. Rather than keep editing this message I'm going with a very generic "Uh, we don't do that!" type of error. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-21git-gui: Factor out common fast-forward merge caseShawn O. Pearce
In both the ff and reset merge_types supported by checkout_op the result is the same if the merge base of our target commit and the existing commit is the existing commit: its a fast-forward as the existing commit is fully contained in the target commit. This minor cleanup in logic will make it easier to implement a new kind of merge_type that actually merges the two trees with a real merge strategy, such as git-merge-recursive. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-21git-gui: Save the merge base during checkout_op processingShawn O. Pearce
I've decided to teach checkout_op how to perform more than just a fast-forward and reset type of merge. This way we can also do a full recursive merge even when we are recreating an existing branch from a remote. To help with that process I'm saving the merge-base we computed during the ff/reset/fail decision process, in case we need it later on when we actually start a true merge operation. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-21git-gui: Automatically backup the user's commit bufferShawn O. Pearce
A few users have been seeing crashes in Tk when using the undo key binding to undo the last few keystroke events in the commit buffer. Unfortunately that means the user loses their commit message and must start over from scratch when the user restarts the process. git-gui now saves the user's commit message buffer every couple of seconds to a temporary file under .git (specifically .git/GITGUI_BCK). At exit time we rename this file to .git/GITGUI_MSG if there is a message, the file exists, and it is currently synchronized with the Tk buffer. Otherwise we do our usual routine of saving the Tk buffer to .git/GITGUI_MSG and delete .git/GITGUI_BCK, if it exists. During startup we favor .git/GITGUI_BCK over .git/GITGUI_MSG. This way a crash doesn't take out the user's message buffer but instead will cause the user to lose only a few keystrokes. Most people do not type more than 200 WPM, and with 30 possible saves per minute we are unlikely to lose more than 7 words. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-19git-gui: Completely remove support for creating octopus mergesShawn O. Pearce
I'm working on refactoring the UI of the merge dialog, because as it currently stands the dialog is absolutely horrible, especially when you have 200+ branches available from a single remote system. In that refactoring I plan on using the choose_rev widget to allow the user to select exactly which branch/commit they want to merge. However since that only selects a single commit I'm first removing the code that supports octopus merges. A brief consultation on #git tonight seemed to indicate that the octopus merge strategy is not as useful as originally thought when it was invented, and that most people don't commonly use them. So making users fall back to the command line to create an octopus is actually maybe a good idea here, as they might think twice before they use it. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-19git-gui: Don't show blame tooltips that we have no data forShawn O. Pearce
If we haven't yet loaded any commit information for a given line but our tooltip timer fired and tried to draw the tooltip we shouldn't; there is nothing to show. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-19git-gui: Translate standard encoding names to Tcl onesShawn O. Pearce
This is a essentially a copy of Paul Mackerras encoding support from gitk. I stole the code from gitk commit fd8ccbec4f0161, as Paul has already done all of the hard work setting up this translation table. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-18git-gui: Convert merge dialog to use class systemShawn O. Pearce
I've found that the class code makes it a whole lot easier to create more complex GUI code, especially the dialogs. So before I make any major improvements to the merge dialog's interface I'm going to first switch it to use the class system, so the code is slightly cleaner. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-18git-gui: Increase the default height of the revision pickerShawn O. Pearce
Showing only five lines of heads/tags is not very useful to a user when they have about 10 branches that match the filter expression. The list is just too short to really be able to read easily, at least not without scrolling up and down. Expanding the list out to 10 really makes the revision picker easier to read and access, as you can read the matching branches much more quickly. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-18git-gui: Allow users to browse any branch, not just the current oneShawn O. Pearce
We now allow users to pick which commit they want to browse through our revision picking mega-widget. This opens up in a dialog first, and then opens a tree browser for that selected commit. It is a very simple approach and requires minimal code changes. I also clarified the language a bit in the Repository menu, to show that these actions will access files. Just in case a user is not quite sure what specific action they are looking for, but they know they want some sort of file thing. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-18git-gui: Allow browser subcommand to start in subdirectoryShawn O. Pearce
Like our blame subcommand the browser subcommand now accepts both a revision and a path, just a revision or just a path. This way the user can start the subcommand on any branch, or on any subtree. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-18git-gui: Delay the GC hint until after we are runningShawn O. Pearce
I'm moving the code related to looking to see if we should GC now into a procedure closer to where it belongs, the database module. This reduces our script by a few lines for the single commit case (aka citool). But really it just is to help organize the code. We now perform the check after we have been running for at least 1 second. This way the main window has time to open up and our dialog (if we open it) will attach to the main window, instead of floating out in no-mans-land like it did before on Mac OS X. I had to use a wait of a full second here as a wait of 1 millisecond made our console install itself into the main window. Apparently we had a race condition with the console code where both the console and the main window thought they were the main window. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-18git-gui: Don't crash in ask_popup if we haven't mapped main window yetShawn O. Pearce
If we have more than our desired number of objects and we try to open the "Do you want to repack now?" dialog we cannot include a -parent . argument if the main window has not been mapped yet. On Mac OS X it appears this window isn't mapped right away, so we had better hang avoid including it. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-17git-gui: Always disable the Tcl EOF character when readingShawn O. Pearce
On Windows (which includes Cygwin) Tcl defaults to leaving the EOF character of input file streams set to the ASCII EOF character, but if that character were to appear in the data stream then Tcl will close the channel early. So we have to disable eofchar on Windows. Since the default is disabled on all platforms except Windows, we can just disable it everywhere to prevent any sort of read problem. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-12git-gui: Change prior tree SHA-1 verification to use git_readShawn O. Pearce
This cat-file was done on maint, where we did not have git_read available to us. But here on master we do, so we should make use of it. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-12Merge branch 'maint'Shawn O. Pearce
* maint: git-gui: Work around bad interaction between Tcl and cmd.exe on ^{tree}
2007-07-12git-gui: Work around bad interaction between Tcl and cmd.exe on ^{tree}gitgui-0.7.5Shawn O. Pearce
From Johannes Sixt <J.Sixt@eudaptics.com>: > It seems that MSYS's wish does some quoting for Bourne shells, > in particular, escape the first '{' of the "^{tree}" suffix, but > then it uses cmd.exe to run "git rev-parse". However, cmd.exe does > not remove the backslash, so that the resulting rev expression > ends up in git's guts as unrecognizable garbage: rev-parse fails, > and git-gui hickups in a way that it must be restarted. Johannes originally submitted a patch to this section of commit.tcl to use `git rev-parse $PARENT:`, but not all versions of Git will accept that format. So I'm just taking the really simple approach here of scanning the first line of the commit to grab its tree. About the same cost, but works everywhere. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-10git-gui: Include a space in Cygwin shortcut command linesShawn O. Pearce
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-10git-gui: Use sh.exe in Cygwin shortcutsShawn O. Pearce
Because we are trying to execute /bin/sh we know it must be a real Windows executable and thus ends with the standard .exe suffix. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-10git-gui: Paper bag fix for Cygwin shortcut creationShawn O. Pearce
We cannot execute the git directory, it is not a valid Tcl command name. Instead we just want to pass it as an argument to our sq proc. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-10Merge branch 'maint'Shawn O. Pearce
* maint: git-gui: Don't linewrap within console windows git-gui: Correct ls-tree buffering problem in browser
2007-07-10git-gui: Don't linewrap within console windowsShawn O. Pearce
If we get more than 80 characters of text in a single line odds are it is output from git-fetch or git-push and its showing a lot of detail off to the right edge that is not so important to the average user. We still want to make sure we show everything we need, but we can get away with that information being off to the side with a horizontal scrollbar. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-10git-gui: Correct ls-tree buffering problem in browserShawn O. Pearce
Our file browser was showing bad output as it did not properly buffer a partial record when read from `ls-tree -z`. This did not show up on my Mac OS X system as most trees are small, the pipe buffers generally big and `ls-tree -z` was generally fast enough that all data was ready before Tcl started to read. However on my Cygwin system one of my production repositories had a large enough tree and packfile that it took a couple of pipe buffers for `ls-tree -z` to complete its dump. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-09git-gui: Improve the Windows and Mac OS X shortcut creatorsShawn O. Pearce
We now embed any GIT_* and SSH_* environment variables as well as the path to the git wrapper executable into the Mac OS X .app file. This should allow us to restore the environment properly when we restart. We also try to use proper Bourne shell single quoting when we can, as this avoids any sort of problems that might occur due to a path containing shell metacharacters. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-09git-gui: Teach console widget to use git_readShawn O. Pearce
Now that we are pretty strict about setting up own absolute paths to any git helper (saving a marginal runtime cost to resolve the tool) we can do the same in our console widget by making sure all console execs go through git_read if they are a git subcommand, and if not make sure they at least try to use the Tcl 2>@1 IO redirection if possible, as it should be faster than |& cat. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-09git-gui: Always use absolute path to all git executablesShawn O. Pearce
Rather than making the C library search for git every time we want to execute it we now search for the main git wrapper at startup, do symlink resolution, and then always use the absolute path that we found to execute the binary later on. This should save us some cycles, especially on stat challenged systems like Cygwin/Win32. While I was working on this change I also converted all of our existing pipes ([open "| git ..."]) to use two new pipe wrapper functions. These functions take additional options like --nice and --stderr which instructs Tcl to take special action, like running the underlying git program through `nice` (if available) or redirect stderr to stdout for capture in Tcl. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-09git-gui: Show a progress meter for checking out filesShawn O. Pearce
Sometimes switching between branches can take more than a second or two, in which case `git checkout` would normally have shown a small progress meter to the user on the terminal to let them know that we are in fact working, and give them a reasonable idea of when we may finish. We now do obtain that progress meter from read-tree -v and include it in our main window's status bar. This allows users to see how many files we have checked out, how many remain, and what percentage of the operation is completed. It should help to keep users from getting bored during a large checkout operation. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-09git-gui: Change the main window progress bar to use status_barShawn O. Pearce
Now that we have a fancy status bar mega-widget we can reuse that within our main window. This opens the door for implementating future improvements like a progress bar. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-09git-gui: Extract blame viewer status bar into mega-widgetShawn O. Pearce
Our blame viewer has had a very fancy progress bar at the bottom of the window that shows the current status of the blame engine, which includes the number of lines completed as both a text and a graphical meter. I want to reuse this meter system in other places, such as during a branch switch where read-tree -v can give us a progress meter for any long-running operation. This change extracts the code and refactors it as a widget that we can take advantage of in locations other than in the blame viewer. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-09git-gui: Allow double-click in checkout dialog to start checkoutShawn O. Pearce
If the user double clicks a branch in the checkout dialog then they probably want to start the checkout process on that branch. I found myself doing this without realizing it, and of course it did nothing as there was no action bound to the listbox's Double-Button-1 event handler. Since I did it without thinking, others will probably also try, and expect the same behavior. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-09git-gui: Default selection to first matching refShawn O. Pearce
If we have specifications listed in our revision picker mega-widget then we should default the selection within that widget to the first ref available. This way the user does not need to use the spacebar to activate the selection of a ref within the box; instead they can navigate up/down with the arrow keys and be done with it. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-09git-gui: Refactor branch switch to support detached headShawn O. Pearce
This is a major rewrite of the way we perform switching between branches and the subsequent update of the working directory. Like core Git we now use a single code path to perform all changes: our new checkout_op class. We also use it for branch creation/update as it integrates the tracking branch fetch process along with a very basic merge (fast-forward and reset only currently). Because some users have literally hundreds of local branches we use the standard revision picker (with its branch filtering tool) to select the local branch, rather than keeping all of the local branches in the Branch menu. The branch menu listing out all of the available branches is simply not sane for those types of huge repositories. Users can now checkout a detached head by ticking off the option in the checkout dialog. This option is off by default for the obvious reason, but it can be easily enabled for any local branch by simply checking it. We also detach the head if any non local branch was selected, or if a revision expression was entered. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-09git-gui: Refactor our ui_status_value update techniqueShawn O. Pearce
I'm really starting to dislike global variables. The ui_status_value global varible is just one of those that seems to appear in a lot of code and in many cases we didn't even declare it "global" within the proc that updates it so we haven't always been getting all of the updates we expected to see. This change introduces two new global procs: ui_status $msg; # Sets the status bar to show $msg. ui_ready; # Changes the status bar to show "Ready." The second (special) form is used because we often update the area with this message once we are done processing a block of work and want the user to know we have completed it. I'm not fixing the cases that appear in lib/branch.tcl right now as I'm actually in the middle of a huge refactoring of that code to support making a detached HEAD checkout. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-09git-gui: Automatically refresh tracking branches when neededShawn O. Pearce
If the user is creating a new local branch and has selected to use a tracking branch as the starting revision they probably want to make sure they are using the absolute latest version available of that branch. We now offer a checkbox "Fetch Tracking Branch" (on by default) that instructs git-gui to run git-fetch on just that one branch before resolving the branch name into a commit SHA-1 and making (or updating) the local branch. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-09git-gui: Option to default new branches to match tracking branchesShawn O. Pearce
In some workflows users will want to almost always just create a new local branch that matches a remote branch. In this type of workflow it is handy to have the new branch dialog default to "Match Tracking Branch" and "Starting Revision"-Tracking Branch", with the focus in the branch filter field. This can save users working on this type of workflow at least two mouse clicks every time they create a new local branch or switch to one with a fast-forward. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-09git-gui: Sort tags descending by tagger dateShawn O. Pearce
When trying to create a branch from a tag most people are looking for a recent tag, not one that is ancient history. Rather than sorting tags by their string we now sort them by taggerdate, as this places the recent tags at the top of the list and the very old ones at the end. Tag date works nicely as an approximation of the actual history order of commits. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-09git-gui: Enhance choose_rev to handle hundreds of branchesShawn O. Pearce
One of my production repositories has hundreds of remote tracking branches. Trying to navigate these through a popup menu is just not possible. The list is far larger than the screen and it does not scroll fast enough to efficiently select a branch name when trying to create a branch or delete a branch. This is major rewrite of the revision chooser mega-widget. We now use a single listbox for all three major types of named refs (heads, tracking branches, tags) and a radio button group to pick which of those namespaces should be shown in the listbox. A filter field is shown to the right allowing the end-user to key in a glob specification to filter the list they are viewing. The filter is always taken as substring, so we assume * both starts and ends the pattern the user wanted but otherwise treat it as a glob pattern. This new picker works out really nicely. What used to take me at least a minute to find and select a branch now takes mere seconds. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-09git-gui: Fast-forward existing branch in branch create dialogShawn O. Pearce
If the user elects to create a local branch that has the same name as an existing branch and we can fast-forward the local branch to the selected revision we might as well do the fast-forward for the user, rather than making them first switch to the branch then merge the selected revision into it. After all, its really just a fast forward. No history is lost. The resulting branch checkout may also be faster if the branch we are switching from is closer to the new revision. Likewise we also now allow the user to reset the local branch if it already exists but would not fast-forward. However before we do the actual reset we tell the user what commits they are going to lose by showing the oneline subject and abbreviated sha1, and we also let them inspect the range of commits in gitk. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-09git-gui: Allow users to match remote branch names locallyShawn O. Pearce
Some workflows have users create a local branch that matches a remote branch they have fetched from another repository. If the user wants to push their changes back to that remote repository then they probably want to use the same branch name locally so that git-gui's push dialog can setup the push refspec automatically. To prevent typos with the local branch name we now offer an option to use the remote tracking branch name as the new local branch name. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-09git-gui: Maintain remote and source ref for tracking branchesShawn O. Pearce
In the next change I want to let the user create their local branch name to match the remote branch name, so that the existing push dialog can push the branch back up to the remote repository without needing to do any sort of remapping. To do that we need to know exactly what branch name the remote system is using. So all_tracking_branches returns a list of specifications, where each specification is itself a list of: - local ref name (destination we fetch into) - remote name (repository we fetch from) - remote ref name (source ref we fetch from) Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-09git-gui: Optimize for newstyle refs/remotes layoutShawn O. Pearce
Most people using Git 1.5.x and later are using the newer style of remotes layout where all of their tracking branches are in refs/remotes and refs/heads contains only the user's own local branches. In such a situation we can avoid calling is_tracking_branch for each head we are considering because we know that all of the heads must be local branches if no fetch option or Pull: line maps a branch into that namespace. If however any remote maps a remote branch into a local tracking branch that resides in refs/heads we do exactly what we did before, which requires scanning through all fetch lines in case any patterns are matched. I also switched some regexp/regsub calls to string match as this can be a faster operation for prefix matching. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-09git-gui: Refactor the delete branch dialog to use class systemShawn O. Pearce
A simple refactoring of the delete branch dialog to allow use of the class construct to better organize the code and to reuse the revision selection code of our new choose_rev mega-widget. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-09git-gui: Abstract the revision picker into a mega widgetShawn O. Pearce
This rather large change pulls the "Starting Revision" part of the new branch dialog into a mega widget that we can use anytime we need to select a commit SHA-1. To make use of the mega widget I have also refactored the branch dialog to use the class system, much like the delete remote branch dialog already does. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-09git-gui: Teach class system to support [$this cmd] syntaxShawn O. Pearce
Its handy to be able to ask an object to do something for you by handing it a subcommand. For example if we want to get the value of an object's private field the object could expose a method that would return that value. Application level code can then invoke "$inst get" to perform the method call. Tk uses this pattern for all of its widgets, so we'd certainly like to use it for our own mega-widgets that we might develop. Up until now we haven't needed such functionality, but I'm working on a new revision picker mega-widget that would benefit from it. To make this work we have to change the definition of $this to actually be a procedure within the namespace. By making $this a procedure any caller that has $this can call subcommands by passing them as the first argument to $this. That subcommand then needs to call the proper subroutine. Placing the dispatch procedure into the object's variable namespace ensures that it will always be deleted when the object is deleted. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>