Commit Graph

1046 Commits

Author SHA1 Message Date
Roddi 535ef4e93a fixed warnings and analyser hits 2010-06-08 19:03:55 +02:00
Roddi 9a5efabba3 added missing delegate protocol declaration to remove warnings for 10.6 2010-05-17 16:51:53 +02:00
André Berg d54dca4f42 Remove debugging NSLog clutter and other left-over code. 2010-04-06 00:03:07 +02:00
André Berg d1474bd22a Improving configuration of NSArrayController in PBGitHistoryView. 2010-04-05 23:52:04 +02:00
André Berg 10daa222b5 Major overhaul of the handling/effect of CLI args (gitx/PBCLIProxy).
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.
2010-04-05 23:50:03 +02:00
André Berg f87cfa6900 Add #import "BMScript.h" to PBSourceViewItem since it needs it for debugDescription. 2010-04-05 23:00:48 +02:00
André Berg 8ddcc6c660 Add DO directional/value qualifier keywords to PBCLIProxy
Specifying these helps to improve DO performance and it should also help
with the NSURL passed byref thingy (see PBCLIProxy.m), although we don't
really need that anymore because we changed the parameters to be NSString's
which by default are passed bycopy.

Specifying "oneway void" creates a fire-and-forget situation where the 
distant object will not wait for the value returned.
2010-04-05 22:58:35 +02:00
André Berg bee02b18cf Add a check for hasPrefix:@"refs/" to isSimpleRef logic in PBGitRevSpecifier. 2010-04-05 22:51:33 +02:00
André Berg 11688c9319 If launched from CLI return immediately from observeValueForKeyPath...
in PBGitHistoryController, since this will prevent commit list selection
changes while a deferred selection is undergoing.

A deferred selection is processed when a launch from CLI occurrs with CLI
args containing strings like "<SHA>", or "--subject=<word>", etc. 
(see gitx.m).

What happens is that a 0.5s delayed selector will be performed from the 
ApplicationController after the CLI args where processed. After this has
happened, launchedFromGitx will be NO and thus KVO can continue as it 
normally would.
2010-04-05 21:34:00 +02:00
André Berg 1d4e4c554b Only update selectedCommit in [PBGitHistoryController updateKeys] when not nil. 2010-04-05 21:28:52 +02:00
André Berg f704c99fa8 Add a NSUserDefaultsDidChangeNotification listener to PBGitHistoryController.
Add method decl signatures for updateKeys and scrollSelectionToTopOfViewFrom:

- Call preferencesChangedWithNotification: on self when the notification is
received. This gives us the opportunity to refresh the history controller's
commit list in case defaults like the relative dates option have changed.
This makes the effect of switching that option while the prefs panel is still
open instant.
2010-04-05 21:27:45 +02:00
André Berg 4ed7911c6f Multiple changes to -selectCommit: from PBGitHistoryController.
- Change return type from void to BOOL to convey if selecting succeeded 
  or not.

- Return NO if the cliArgs from sharedApplicationController contain "--commit",
  since then we need to just show the commit stage. Updating the commit list
  selection is not necessary. In fact, it will confuse order among consequent 
  calls.

- If the oldIndex equals NSNotFound, try to get the index of the currently 
  selected object by finding it among the content object of the commitController.
  
  If we find it we save the result in an ivar called selectedCommit so that 
  subsequent calls will always have this available as an alternative back-up
  plan.
2010-04-05 21:24:00 +02:00
André Berg c85fa2f216 Declare sidebarController property as __weak in PBGitWindowController.
Add some more (__ weak) properties which hold the other controller objects.
2010-04-05 21:15:10 +02:00
André Berg 3f7b66284b Minor file layout changes to PBGitHistoryController.
- Rearrange some ivar declarations and bunch IBOutlets etc. together for better
  visual acuity.
- Add readonly properties for searchField, commitList and webView.
2010-04-05 21:12:48 +02:00
André Berg bc44ebfa01 Add new Error constants to PBGitXErrors, mostly for CLI support 2010-04-05 21:09:42 +02:00
André Berg 7761d2f06f Add shell script methods to PBGitRepository.
These use BMScript which may be overkill considering we have like a whole load 
of PBEasyPipe commands and their wrappers in the repository but I just found for
one or two tasks where I really had to work with a full featured shell script
PBEasyPipe was a bit limited.
2010-04-05 17:00:30 +02:00
André Berg 0c26fb5dde Remove launchedFromCLI ivar from PBGitRepository.
Purely cosmetic: rearrange some @synthesized directives.

State like this is now more appropriately managed by the ApplicationController.
2010-04-05 16:50:11 +02:00
André Berg 4b4912a57a Add some more checking/validation methods to PBGitRepository.
- Add a shaExists method that takes string with a SHA and either returns the full
  SHA if it exists or nil if not.
- Add a completeRefForString: method which completes partial refs like "xyz/master"
  to "refs/remotes/xyz/master" for example.
- Add a checkRefFormatForBranch: method which does the same as checkRefFormat 
  except it also works with partial branch refs like "xyz/master".
- Add headRefForSHA skeleton to encapsulate the shell-script-fu from populateList
  in PBGitSidebarController that deals with getting the head ref for a SHA.
2010-04-05 16:45:34 +02:00
André Berg 5cb73b4d42 Bug fix: correct visible index scrolling in PBGitHistoryController and PBCommitList.
If the current branch filter is switched to "All" or "Local" the index that's
calculated as being the targeted index to scroll to visible, is off by the amount
in Y that the bottom split view separator is off from a multiple of rows.

-adjustScroll: on PBCommitList is called automatically whenever the list needs 
laying out. 
An ivar keeps track if we come from the -scrollSelectionToTopOfViewFrom: method
of PBGitHistoryController.

I'll leave the commented out NSLogs in there in case they're needed for debugging
again later.
2010-04-05 16:32:59 +02:00
André Berg ba63642c87 Add a method declaration to PBGitRevSpecifier.h to silence a compiler warning. 2010-04-05 16:25:08 +02:00
André Berg 8df20db49d Add PBStringFromBranchFilterType() function for debugging purposes to PBGitRepository.
Add a PBGitXBranchFilterType typedef to the kGitX... branch filters enum.
2010-04-05 16:22:06 +02:00
André Berg 23a1ddd73b Remove a superfluous semicolon in PBCommitList.m 2010-04-05 16:15:54 +02:00
André Berg 8bc8a73e1b Put at-sign in front of multi-line continued string.
Probably doesn't matter since the compiler should concatenate both forms equally.
2010-04-05 16:12:11 +02:00
André Berg 69d23e9e08 Move Remote segmented controls from Sidebar to Repository window's top gradient bar.
Now, I know conceptually the Remotes segmented control was down there because it is
related to the repository and the current branch, but I really grew tired having to 
travel all the way down the monitor real estate just to click a button. 
And you can't just fast travel down, you need be quite specific with the click.
2010-04-05 15:52:01 +02:00
André Berg 93483cb9a9 Adjust the last two panels in Preferences.xib in width to match the first. 2010-04-05 14:14:46 +02:00
André Berg 85b2de9431 Disable hidden entries in MainMenu.xib/File and remove the saveAs: target connection. 2010-04-05 12:59:12 +02:00
André Berg 7b743679a5 Add -description and -debugDescription methods to PBSourceViewItem.m 2010-04-05 12:53:50 +02:00
André Berg 5fb70a8a3e Make ApplicationController a singleton class. 2010-04-05 12:53:06 +02:00
André Berg a45f8658be Make default (id) explicit for some method decls/defs in PBGitHistoryController.m 2010-04-05 11:04:00 +02:00
André Berg 229387cf80 Populate the revList if empty in -commitForSHA:
I found that at a few points logic was based on items from revList but
at that point in the execution the revList was always empty.
2010-04-05 10:52:21 +02:00
André Berg 8e55c30b38 Make building and installing possible right from within Xcode.
Edit install.sh to use gitx_askpasswd so that a password dialog is shown whenever
sudo is used in the install script.

Also split the install logic in install.sh based on BUILD_STYLE so that 
installing GitX and gitx (CLI) is possible each on its own.
2010-04-05 10:48:29 +02:00
André Berg d76072f5e7 Add -description and/or -debugDescription methods to PBGitCommit, PBGitRef and PBGitRevSpecifier. 2010-04-05 10:41:24 +02:00
André Berg 3158d0f8e6 Apply Nathan Kissinger's bugfixes to NSFileHandleExt.m (s. GitX Google Group) 2010-04-05 04:46:48 +02:00
André Berg 7e986fbdc5 Add in left-out (id) return labels to some methods in PBGitCommit. 2010-03-30 15:53:20 +02:00
André Berg 591528824d Add readonly __weak superController access to PBViewController. 2010-03-30 15:51:24 +02:00
André Berg 25b47bb34b Reinstate the -finalize method to remove ourselves as observer.
I was confusing KVO with Notifications earlier, as the GC Programming Guide 
explicitly says one should not unregister notifications in a finalize method 
when using GC.
2010-03-30 15:20:29 +02:00
André Berg 156d67f1fb Add -debugDescription and -description to PBGitRef 2010-03-30 15:11:16 +02:00
André Berg 34c404a6d9 Stability: employ more sanity checks when parsing author details from history.js (part 2) 2010-03-30 15:10:47 +02:00
André Berg 75fbde6d6c Make comment about "Subtle Dangers of DO" a lot smaller 2010-03-30 15:09:38 +02:00
André Berg a763dd83c5 Add a property to PBGitRepository that indicates if we are launching from CLI (gitx). 2010-03-30 15:04:05 +02:00
André Berg 4428373de5 Make the prefs panel update all open document views on close. 2010-03-30 14:34:48 +02:00
André Berg d12b92349b Stability: employ more sanity checks when parsing author details from history.js 2010-03-30 14:33:49 +02:00
André Berg d43e72f6dd Tweak to the context slider response time (hopefully final this time). 2010-03-26 11:39:12 +01:00
André Berg 557ff4edad Switch DEBUG_INFORMATION_FORMAT from DWARF with dSYM to DWARF in Release.xcconfig. 2010-03-26 11:38:42 +01:00
André Berg ad766c5c17 Delete some non functional left overs from a previous merge. 2010-03-26 11:38:04 +01:00
André Berg f0a3502c72 Make the gitx arguments "--all" and "--local" (new) switch to the corresponding branch filtered output instead of adding the argument name to the "OTHERS" group. 2010-03-26 11:36:06 +01:00
André Berg 50185248c7 Install gitx (the CLI) via Install.sh.
To do this we use a modified gitx_askpasswd to ask for sudo permissions during build.

Modifications to gitx_askpasswd include:

- Ability to specify the dialog info text (or title) via STDIN or a GITX_ASKPASSWD_DIALOG_TITLE env variable.
  Install.sh uses the env var in 'sudo -A -E' to kindly request the password.
  
  The point of this is to provide a sensible title which lets the user/dev know why he has to enter his password in a dialog that is obviously not from Mac OS X. 

Install.sh will now also create the folder hierarchy needed for the install paths set in Install.xcconfig using 'sudo -A -E' if neccessary (if the folders don't exist).
2010-03-26 11:33:32 +01:00
André Berg 7b2868561b Incorporate roddi/gitx aed059eb ("corrected script file permissions"). 2010-03-26 01:28:37 +01:00
André Berg 0dc27819b8 Delete some overlooked overwrites in Xcode's Project build settings dialog. 2010-03-26 01:20:12 +01:00
André Berg 404dee7968 Move some settings from Install.xcconfig that are intended for Release as well over.
Add intended usage note to Install.xcconfig.
2010-03-26 01:19:37 +01:00