Commit Graph

115 Commits

Author SHA1 Message Date
Nathan Kinsinger 46b6057ce1 Speed up commit's isOnSameBranch
Use the cached commit list to avoid asking git for the info. This is used to update GUI buttons and when opening the contextual menu so making it fast is important. It wasn't possible before because we weren't storing all the commits.
2010-03-13 22:16:47 -07:00
Nathan Kinsinger 4a8c524692 Add branch view filters to history scope bar
- filters for All, Local/Remote, and the selected branch
        - "Local" includes both branches and tags
        - "Remote" includes all branches from the same remote as the selected remote branch (i.e. not other remotes)

Changes to make the above work:
    - add a history list class between the repository and rev list
        - store a project rev list with all the commits from the project
        - use the project rev list to graph the history for individual branches when there have been no changes
        - use a different rev list to show non-simple revs (history of a file, revs from the gitx tool)
        - update the commits in chunks to a mutable array so the table view's array controller has less work to do
        - only update the project rev list from git when actually necessary
    - don't add the All Branches and Local Branches revs to the branches array
    - some changes related to forcing the project's rev list to update when changes are made
    - some changes related to not causing updates too often
    - store the selected filter in user defaults
    - when the graphing is done select the commit for the branch
2010-03-13 22:16:44 -07:00
Nathan Kinsinger c83f77801e Delete branches when the refs are deleted
In reloadRefs:
    - check for any branches that are no longer in the repo and delete them
        - except the detached HEAD and the "other" revs
    - send KVO notice for the refs ivar changing
    - get rid of the BOOL return value as it's not being used
    - get rid of the outdated comments
    - clean things up a bit
2010-03-13 22:16:40 -07:00
Nathan Kinsinger 1323638791 Add/modify convenience methods in PBRevSpecifier
- NSCopying
    - change isEqualTo: to isEqual: so that it works well with NSArray's (containsObject: and removeObject: will use isEqual: instead of pointer equality)
    - add hash to go with isEqual:
    - pre-calculate the isSimpleRef value. The rangeOf... methods are very slow and have a major effect on the tight loop in reloadRefs.
2010-03-13 22:16:34 -07:00
Nathan Kinsinger ef8fed6f4e Fix up the stage view's commit message text view
- stop the spelling error markers from being drawn over
    - allow undo/redo in the commit message view
2010-03-13 22:16:27 -07:00
Nathan Kinsinger 2321ec8c47 Add and delete refs from the source list view
Observe the branches array and update the sidebar when refs are added or deleted.

Sort new items based on the title.
2010-03-13 22:15:06 -07:00
Nathan Kinsinger d3d700a138 Add Clone To… to the File menu
Will clone an open repository to a folder. Opens a sheet with a custom accessory view that has a checkbox to allow creating a bare repo.
2010-03-13 12:52:44 -07:00
Nathan Kinsinger 4bcbf43dc4 Add convenience method for the repository's projectName
Update the displayName method to use it
2010-03-13 12:52:41 -07:00
Nathan Kinsinger fe5dddc681 Add Add Remote
- Add Remote in the Repository menu
    - an Add Remote Sheet
2010-03-13 12:52:33 -07:00
Nathan Kinsinger 6e405972e8 Add Push to the contextual menus for refs 2010-03-13 12:52:29 -07:00
Nathan Kinsinger 46e996f5c6 Add Pull to the contextual menus for refs 2010-03-13 12:52:26 -07:00
Nathan Kinsinger 4654dc105f Add Fetch to the contextual menus for refs 2010-03-13 12:52:22 -07:00
Nathan Kinsinger 55973b4aff Add convenience methods for remotes 2010-03-13 12:42:19 -07:00
Nathan Kinsinger 7eec230959 Add Rebase to the contextual menu for commits and refs 2010-03-13 12:42:10 -07:00
Nathan Kinsinger e50ddbc503 Add Cherry Pick to contextual menu for commits. 2010-03-13 12:42:06 -07:00
Nathan Kinsinger e2ccfe6fce Add Merge in the contextual menus for commits and refs 2010-03-13 12:42:02 -07:00
Nathan Kinsinger 8359883c92 Rename removeRef: to showDeleteRefSheet:
- move the core of the delete implementation to the repository as deleteRef:
    - move it to it's own pragma mark section
2010-03-13 12:41:56 -07:00
Nathan Kinsinger dceabb6702 Add Checkout Files to file browser contextual menu
Allows checking out the state of a file from any commit to the working directory.
2010-03-13 12:41:50 -07:00
Nathan Kinsinger 69d67820f6 Add Checkout
Checkout:
    - PBGitRepository: add checkoutRefish:
    - PBRefController: renamed checkoutRef: to checkout: and use new method in PBGitRepository
    - add to the contextual menus for commits (it was already in the menu for refs)
    - add "Checkout branch" checkbox to the Create Branch sheet
        - store the state in the defaults
    - tell the commitController to rearrangeObjects so that the refs highlight correctly (seems to only be a problem when going from a branch to a detached HEAD at the same commit)
2010-03-13 12:41:30 -07:00
Nathan Kinsinger aa4a24a579 Add Create Tag
A Create Tag item:
    - A new class (and xib) PBCreateTagSheet
    - In the Repository menu
    - In the contextual menu for commits

PBRefController the method tagInfo:
    - renamed to showTagInfoSheet:
    - moved it under the Tags mark
2010-03-13 12:41:24 -07:00
Nathan Kinsinger 9f048f6363 Update Create Branch
Update the methods for creating a branch.
    - create new class and xib PBCreateBranchSheet
    - remove old addRef: methods and iVars from PBRefController
    - remove old sheet from PBHistoryView.xib
    - put the implementation method in PBGitRepository
    - add a contextual menu item for commits
    - shows an error sheet
    - ask the commitController to rearrangeObjects to make sure the new branch is shown
    - switch from using "update-ref" to "branch" so that branches starting at a remote branch will track automatically (or not depending on the repo's settings)
2010-03-06 16:30:50 -07:00
Nathan Kinsinger b61028a06a Add support methods needed for future commits.
PBGitCommit
PBGitRevSpecifier
PBGitRepository
2010-03-06 15:56:54 -07:00
Nathan Kinsinger 1c4601dd52 PBGitConfig: Change name of -initWithRepository:
Better indicates the information needed and stops a compiler warning about wrong type (there are other initWithRepository: methods that take a different type).
2010-02-19 22:54:49 -07:00
Pieter de Bie fa6ff44d0b PBGitRepository: Clean up the readFromURL: method
We used a BOOL value which was returned afterwards,
but we might as well just return early and simplify everything
2009-06-20 21:33:22 +01:00
Benoit Cerrina fa6182e2a4 PBGitRepository: Fix opening of large directories due to bug in NSFileWrapper.
This commit changes  readFromFileWrapper:ofType:error: to readFromURL:ofType:error:.

The default implementation of readFromURL calls readFromFileWrapper, but a bug
in NSFileWrapper makes this fail with repositories with a large number of files
(not sure if the fact that those files were in subdirectories matter or not).

So instead we skip the whole FileWrapper thing, which we don't really use anyway,
and just use the URL.
2009-06-20 21:33:22 +01:00
Pieter de Bie aa43e18d61 PBGitRepository: Add support for changing the environment when executing commands 2009-06-11 18:57:34 +01:00
Pieter de Bie b382b34118 PBGitRepository: Specify environment when calling hooks 2009-06-11 18:56:24 +01:00
Johannes Gilger 64b977e9c8 PBGitRepository: Add method to remove branch
This adds a removeBranch method similar to the addBranch method. It
calls these methods when a branch is created/deleted in the UI, avoiding
the cost of simply calling refresh afterwards.

Signed-off-by: Johannes Gilger <heipei@hackvalue.de>
2009-06-06 17:23:51 +01:00
Pieter de Bie 785e7eda42 Merge branch 'stable'
* stable:
  When selecting a folder in tree-view, display the
  PBGitRepository: Correctly indicate bare/non-bare repos
  Get rid of some unnecessary casts
  CommitController: Don't rewrap commit message when amending
  Release notes for 0.6.3
  PBGitCommit: Call git show with --no-color to be safe
  Info.plist: Fix handling of directories
  PBGitIndexController: fix uninitialized value

Conflicts:
	PBGitCommitController.m
2009-05-27 18:25:14 +01:00
Johannes Gilger 5040bdc1c2 PBGitRepository: Correctly indicate bare/non-bare repos
This addresses an issue with non-bare repos which had no core.bare
variable in the config. The isBareRepository-function would work
on the full fileURL (pointing to the .git subdir), which in turn would
indicate a bare repo (this is what git rev-parse --is-bare-repository
returns in .git, and the opposite is true for the superdir).

We work around by using the working-dir for a repo (and directly
indicating a bare repo if there is no workdir). The only issue remaining
is the case of a bare repo manually set to "core.bare = false".

Signed-off-by: Johannes Gilger <heipei@hackvalue.de>
2009-05-27 18:10:17 +01:00
Benjamin Kramer c12e8b9dd4 Get rid of some unnecessary casts 2009-05-27 18:09:29 +01:00
Joe Fiorini a93740a3a7 Enable arguments to be passed to executeHook.
Some hooks, such as commit-msg and
prepare-commit-msg require at least one argument.
This allows executeHook to take an array of
arguments to be passed on to the hook.
2009-05-27 18:03:15 +01:00
Johannes Gilger e9d45261bd PBGitRepository: Display branch-name in window title
This returns not only the name of the git-dir but also the current
branch (or detached HEAD if no local branch is checked out).

When reloading the refs (which also happens when checking-out using
GitX), the displayName-method is called, updating the window-title.

Signed-off-by: Johannes Gilger <heipei@hackvalue.de>
2009-05-18 23:18:59 +01:00
Pieter de Bie b896ac0d56 Allow executing of hooks 2009-05-18 23:05:08 +01:00
Owen Yamauchi 82b6efc1d7 Fix ticket #84: disable commit view for bare repos 2009-02-06 21:09:03 +01:00
Pieter de Bie ddc9ae7654 PBGitCommit: Don't store refs
We already keep this dictionary in our repository. Rather than adding a
pointer to it on every commit in our rev walk, just look it up lazily in the
dictionary when we need to. That cuts down some time in the initial revwalk
and also removes some stupid code :)
2009-01-25 02:14:09 +00:00
Rick Berry 40cceebc9b Fix file path construction when using NSString 2009-01-19 16:55:43 +00:00
Mark Bestley fc00f6c087 CommitView: Add option to add files to .gitignore
In the commit view, add an option in the context menu to have git
ignore them by adding the file names to .gitignore file in the root
of the workarea.
2008-12-22 21:59:11 +01:00
Pieter de Bie 3dd6385440 Fix memory leaks 2008-11-26 17:44:24 +01:00
Pieter de Bie 3d64d83f98 Create a new SpeedTest target
This adds a new target 'SpeedTest', which just loads in a repository
and displays how long it takes to load the revision. This is handy for
testing the speed of the revwalking mechanism
2008-11-24 22:32:46 +01:00
Pieter de Bie 6038c20d7d HistoryView: Add a "Local Branches" option 2008-11-19 02:10:21 +01:00
Pieter de Bie a62e14ffe7 HistoryView: Remove the BranchController
This wasn't used anyway. A good idea would be to create a new
branchcontroller that takes care of all these revs, rather than
letting PBGitRepository take care of that
2008-11-19 01:54:14 +01:00
Pieter de Bie 92437c6663 WIP: Use a nicer branches menu 2008-11-19 01:41:27 +01:00
Pieter de Bie 0975426f2f CommitView: move index functions to separate controller
This merges functionality that was previously stored in the
combination of PBGitCommitController / PBChangedFile to a
dedicated controller, PBGitIndexController.
2008-11-18 23:59:25 +01:00
Pieter de Bie 00e44b35d0 RefController: Allow checking out branches 2008-11-01 23:24:41 +01:00
Pieter de Bie e02ee5231c WebHistoryController: Move ref deletion to RefController
That's why it's there, after all. This also makes the system
more robust and catches some more errors.

The next thing this enables is to also allow right-clicking
on refs in the commit list.
2008-11-01 22:51:10 +01:00
Pieter de Bie 41a906d715 PBGitRepository: Don't return a ref if we error out
This fixes the -parseReference: method to return nil if
there is an error in the git call. This also simplifies
our commit controller.
2008-10-29 00:24:10 +01:00
Pieter de Bie 85c942f530 Merge branch 'pu/pb/git_config'
* pu/pb/git_config:
  CommitView/Gistie: Use github.user and github.login
  Add a way to retrieve values from .git/config files
2008-10-14 16:45:45 +02:00
Pieter de Bie 406125eee2 GitRepository: Cache HEAD ref
Since 63523d00e8 (History view:
Make lozenge of currently checked out branch (HEAD) bold, same as gitk.),
-[PBGitRepository headRef] was called every time a cell needed redrawing.

This made GitX slow overall, but especially when resizing the window.

So, it's better to cache the value. We'll still reload it with an
explicit refresh though.
2008-10-14 01:38:17 +02:00
Pieter de Bie afb3d45656 Add a way to retrieve values from .git/config files
This introduces the PBGitConfig class. It is KVC compliant as far
as I can see, in that you can actually bind to it in IB and use
ValueForKeyPath to retrieve values. It currently only handles
strings; it should be possible to add functions to process
booleans and numbers to it.
2008-10-14 01:02:27 +02:00