Since we now have that gorgeous sidebar and commit list with branch filters,
command line arguments to gitx should utilize these to greater effect.
For example, if I pass:
"--local" >> read current branch and set the branch filter to "Local"
"--all" >> same as above but set "All" branch filter
- partial or full SHA-1 >> should get the branch most likely associated with
that SHA, select it in the sidebar and scroll the commit list to the commit
with the passed SHA.
- partial ref like "xyz/master" >> select the master branch
of the "xyz" folder in the sidebar and scroll the commit list to its most
recent commit.
"--subject=Test" >> filter commit list using a predicate on the commit list's
array controller (basically populating the search field programmatically).
For other "--..." CLI switches it's the same, just the filter predicate is a
bit different each time. You get the idea.
To accomplish this we make the following changes:
- gitx sets two environment variables via setenv(), one for a concatenated
version of the CLI args, and one for the indicator that we launched from gitx.
Using setenv() is unfortunate but I couldn't find a way to do it through DO
and PBCLIProxy since that proxy will do it's processing far too late into
the app's event cycle.
- the now shared application controller stores the two env vars in a BOOL
'launchedFromGitx' and an NSString 'cliArgs'.
- Because GitX makes heavy use of KVO and context switching during the app
launch we introduce the notion of a deferred selection so that we can worry
about selecting the branch and commit the user has passed to gitx in some
form or another, when the app has finished launching completely and all
KVO notifications up to this point have been handled.
- ApplicationController does the bulk work. It stores most state
changes, handles most command line switches (except for a few still in gitx.m),
deals with the deferredSelectObject.
- PBGitSidebarController populateList includes logic for fixing up a ref or
a partial SHA when appController.launchedFromGitx is true. If it can be
resolved we set this as the deferred select object so it can be selected
later on.
I'll leave the excess NSLogs in there for this commit so another can see
what went into this before.
Also implements Finder's fade transitions, handles preview icon creation
through GCD block dispatch and does the right thing regarding events:
Mouse events go to the panel, key events to the fileBrowser outline view.
This patch adds a CFBundleGitRevision key to Info.plist which is set to
the output of "git describe" when building.
The menu-entry for "About GitX" was reconnected to a custom method in
the AppController, which reads the CF-string from the .plist and also
indicates if the build is a DEBUG-build.
Signed-off-by: Johannes Gilger <heipei@hackvalue.de>
Multiple repositories can now be opened by using the File → Open… menu option.
Each document is a PBGitRepository with a PBDetailController controlling the window. PBRepositoryDocumentController is the document controller.
When launched, the application will attempt to open a repository with the current directory as its path. If this fails it will display an open panel to allow the user to select one.