From: Robin Rosenberg <robin.rosenberg@dewire.com>
To: Marek Zawirski <marek.zawirski@gmail.com>
Cc: "Shawn O. Pearce" <spearce@spearce.org>,
git@vger.kernel.org, Robin Rosenberg <robin.rosenberg@dewire.com>
Subject: [EGIT PATCH 2/2] Enable commit for any resource in a Git-shared project
Date: Sun, 31 Aug 2008 11:38:44 +0200 [thread overview]
Message-ID: <1220175524-1523-3-git-send-email-robin.rosenberg@dewire.com> (raw)
In-Reply-To: <1220175524-1523-2-git-send-email-robin.rosenberg@dewire.com>
By default the commit dialog will be populated with all changed resources
in the projects that contain the selected resources, provided the projects
are associated with a Git respository.
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
.../egit/ui/internal/actions/CommitAction.java | 33 +++++++++----------
1 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/actions/CommitAction.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/actions/CommitAction.java
index 8db701c..d703048 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/actions/CommitAction.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/actions/CommitAction.java
@@ -68,7 +68,7 @@ public void run(IAction act) {
return;
}
- Repository[] repos = getRepositories();
+ Repository[] repos = getRepositoriesFor(getProjectsForSelectedResources());
amendAllowed = repos.length == 1;
for (Repository repo : repos) {
if (!repo.getRepositoryState().canCommit()) {
@@ -124,7 +124,7 @@ private void resetState() {
}
private void loadPreviousCommit() {
- IProject project = getSelectedProjects()[0];
+ IProject project = getProjectsForSelectedResources()[0];
Repository repo = RepositoryMapping.getMapping(project).getRepository();
try {
@@ -313,21 +313,20 @@ private void writeTreeWithSubTrees(Tree tree) throws TeamException {
}
private void buildIndexHeadDiffList() throws IOException {
- for (IProject project : getSelectedProjects()) {
+ for (IProject project : getProjectsInRepositoryOfSelectedResources()) {
RepositoryMapping repositoryMapping = RepositoryMapping.getMapping(project);
- if (repositoryMapping != null) {
- Repository repository = repositoryMapping.getRepository();
- Tree head = repository.mapTree("HEAD");
- GitIndex index = repository.getIndex();
- IndexDiff indexDiff = new IndexDiff(head, index);
- indexDiff.diff();
-
- includeList(project, indexDiff.getAdded(), indexChanges);
- includeList(project, indexDiff.getChanged(), indexChanges);
- includeList(project, indexDiff.getRemoved(), indexChanges);
- includeList(project, indexDiff.getMissing(), notIndexed);
- includeList(project, indexDiff.getModified(), notIndexed);
- }
+ assert repositoryMapping != null;
+ Repository repository = repositoryMapping.getRepository();
+ Tree head = repository.mapTree("HEAD");
+ GitIndex index = repository.getIndex();
+ IndexDiff indexDiff = new IndexDiff(head, index);
+ indexDiff.diff();
+
+ includeList(project, indexDiff.getAdded(), indexChanges);
+ includeList(project, indexDiff.getChanged(), indexChanges);
+ includeList(project, indexDiff.getRemoved(), indexChanges);
+ includeList(project, indexDiff.getMissing(), notIndexed);
+ includeList(project, indexDiff.getModified(), notIndexed);
}
}
@@ -395,7 +394,7 @@ private boolean isChanged(RepositoryMapping map, IFile resource) {
@Override
public boolean isEnabled() {
- return getRepositories().length > 0;
+ return getProjectsInRepositoryOfSelectedResources().length > 0;
}
}
--
1.6.0.rc2.35.g04c6e9
next prev parent reply other threads:[~2008-08-31 9:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-31 9:38 [EGIT PATCH] Select all changes in repository for commit by default Robin Rosenberg
2008-08-31 9:38 ` [EGIT PATCH 1/2] Add utilities for figuring out repositories for selected resources Robin Rosenberg
2008-08-31 9:38 ` Robin Rosenberg [this message]
2008-09-02 15:03 ` Shawn O. Pearce
2008-09-02 18:53 ` Robin Rosenberg
2008-09-02 19:00 ` Shawn O. Pearce
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1220175524-1523-3-git-send-email-robin.rosenberg@dewire.com \
--to=robin.rosenberg@dewire.com \
--cc=git@vger.kernel.org \
--cc=marek.zawirski@gmail.com \
--cc=spearce@spearce.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).