Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 225787 - Show number of incoming/outgoing changes from/to upstream in the versioning label of the project
Show number of incoming/outgoing changes from/to upstream in the versioning l...
Status: RESOLVED FIXED
Product: versioncontrol
Classification: Unclassified
Component: Git
7.3
PC Windows 7
: P3 with 2 votes (vote)
: 8.1
Assigned To: Ondrej Vrabec
issues@versioncontrol
:
Depends on: 226364
Blocks:
  Show dependency treegraph
 
Reported: 2013-02-06 10:23 UTC by markiewb
Modified: 2015-07-24 17:42 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments
Shows working state in NetBeans IDE Dev (Build 201507240001) (295.13 KB, image/png)
2015-07-24 17:42 UTC, markiewb
Details

Note You need to log in before you can comment on or make changes to this bug.
Description markiewb 2013-02-06 10:23:38 UTC
I saw this feature in egit and think it is also useful in NB.

EXPECTED: Show the number of incoming/outgoing changes from/to upstream in the versioning label of the project. Example: "... [master] ↑2 ↓3" to show that there are 2 outgoing commits and 3 incoming commits . When there are no in/out- information do not show the information. 

Another usecase: Using this incoming commits information the user will be aware that there will is a pull (+merge) required before push)


Implementation seems to be simple. Use the org.eclipse.jgit.lib.BranchTrackingStatus from the jgit-module to calculate the numbers.
<pre>
JGitRepository jGitRepository = new JGitRepository(repoDir);
BranchTrackingStatus of = BranchTrackingStatus.of(jGitRepository.getRepository(), "master");
System.out.println("of = " + of.getRemoteTrackingBranch());
System.out.println("ahead = " + of.getAheadCount());
System.out.println("behind = " + of.getBehindCount());
</pre>
IMHO the info should also be filtered by the current node. That means when there is a repo with 10 projects, please show only the in/out info which is related the currently project node directory - not for the whole repo.
Comment 1 markiewb 2013-02-06 10:24:48 UTC
Typo: Another usecase: Using this incoming commits information the user will be aware
that there is a pull (+merge) required before pushing)
Comment 2 markiewb 2013-02-06 10:41:00 UTC
You could also show this information in the "git repository browser" tc.
Comment 3 Ondrej Vrabec 2013-02-06 13:03:38 UTC
> Implementation seems to be simple. Use the
> org.eclipse.jgit.lib.BranchTrackingStatus from the jgit-module to calculate the
> numbers.
> <pre>
> JGitRepository jGitRepository = new JGitRepository(repoDir);
> BranchTrackingStatus of =
> BranchTrackingStatus.of(jGitRepository.getRepository(), "master");
> System.out.println("of = " + of.getRemoteTrackingBranch());
> System.out.println("ahead = " + of.getAheadCount());
> System.out.println("behind = " + of.getBehindCount());
> </pre>
Not sure that is what you expect. I am afraid this returns the difference (+/- commits) between the branch and the one in remotes/origin/. In other words you will need to have all commits already on your local machine (you must have run a fetch). This is BTW already implemented and you can observe it in the repository browser. The tooltip on a branch (Branches/Local) displays such information.
But what you probably need is the real difference between your local branch and its tracked branch in the remote repository. But for that we'd need to periodically contact the remote repository (run a fetch) which may be undesirable. I guess a switch or an option to enable/disable suh a feature could be added.

> IMHO the info should also be filtered by the current node. That means when
> there is a repo with 10 projects, please show only the in/out info which is
> related the currently project node directory - not for the whole repo.
What do you mean? If you have several projects in a single repository then all of them are on the same branch. I do not understand what should we filter.
> ProjectA [master +2]
> ProjectB [master +2]
> ProjectC [master +2]
... in/out info is always the same, isn't it? Please make an example so i understand what you meant.
Comment 4 markiewb 2013-02-06 16:48:14 UTC
(In reply to comment #3)
> But what you probably need is the real difference between your local branch and
> its tracked branch in the remote repository. But for that we'd need to
> periodically contact the remote repository (run a fetch) which may be
> undesirable. I guess a switch or an option to enable/disable suh a feature
> could be added.

Yes, that is my request. You could make it switchable when implementation customable label decorators for git (currently not available, but for hq/cvs). The user could decide which text decorations he wants and thats the toggle.

> What do you mean? If you have several projects in a single repository then all
> of them are on the same branch. I do not understand what should we filter.
> > ProjectA [master +2]
> > ProjectB [master +2]
> > ProjectC [master +2]
> ... in/out info is always the same, isn't it? Please make an example so i
> understand what you meant.

For example: A,B,C are in the same repo. If there is a incoming change in project B show the information at node of project B only. But not for project A nor C. Does it make sense?
Comment 5 markiewb 2013-02-06 16:49:09 UTC
See also the original request and impl for egit: http://git.eclipse.org/c/egit/egit.git/commit?id=a15b717a4b9138fb4d11fc07a26e9f9979b0562f
Comment 6 markiewb 2013-02-19 21:44:00 UTC
(In reply to comment #4)
> Yes, that is my request. You could make it switchable when implementation
> customable label decorators for git (currently not available, but for hq/cvs).
> The user could decide which text decorations he wants and thats the toggle.

FYI: customizable status decorators for git are requested by http://netbeans.org/bugzilla/show_bug.cgi?id=226364
Comment 7 sindisil 2013-12-17 20:49:28 UTC
(In reply to Ondrej Vrabec from comment #3)
I'd love to see the decoration, as well (one of the few things I like about egit). However, I'd prefer it to behave same as the tool tip in the repo browser (simply more convenient).

Having NB doing unrequested fetches isn't something I'd like.

I'd just like a clear and obvious indication that the local branch state has diverged from the local notion of the upstream state.

BTW - I didn't know about the tool tip in the repo browser. Thanks for that. Not nearly as visible as a project tree decoration, but still useful.
Comment 8 markiewb 2013-12-17 20:57:26 UTC
(In reply to sindisil from comment #7)
> (In reply to Ondrej Vrabec from comment #3)
> I'd love to see the decoration...

So please vote!
Comment 9 markiewb 2013-12-17 20:58:04 UTC
(In reply to markiewb from comment #8)
> (In reply to sindisil from comment #7)
> > (In reply to Ondrej Vrabec from comment #3)
> > I'd love to see the decoration...
> 
> So please vote!
Sorry. Undo. You already voted...
Comment 10 jonathanvilalopez 2014-09-25 20:02:52 UTC
How is this request going ? It would be so usefull to see if my local repo si not updated with my remote repo.
Comment 11 Ondrej Vrabec 2015-02-06 20:11:26 UTC
decided to do it this way:
- no automatic fetches or connections to remote repositories
- just showing info about the sync status with remote tracking branches.

e.g.: master is ahead of origin/master by 2 commits => shows [master O2]
e.g.: master is behind origin/master by 2 commits => shows [master I2]
e.g.: master needs merge with origin/master => shows [master O2 I2]
all this will be available only if you do periodical fetches (you must fetch commits from the remote repository manually).

Last note: to get this working make sure that Tools -> Options -> Team -> Versioning -> Git | Project Node Format contains "{tracking_status}" variable

Sorry it took so long, any feedback is welcome.

fixed: core-main #222698b695c8
Comment 12 Quality Engineering 2015-02-09 02:22:58 UTC
Integrated into 'main-silver', will be available in build *201502090001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/222698b695c8
User: Ondrej Vrabec <ovrabec@netbeans.org>
Log: Issue #225787 - Show number of incoming/outgoing changes from/to upstream in the versioning label of the project
Comment 13 ChrisLE 2015-07-24 13:14:47 UTC
I tested it in the latest dev build (201507200001) but this doesn't show it to me :/. I added the variable to the team -> git options. I only see the branch. Nothing more. Show incoming/outgoing works, when I call it.
Comment 14 markiewb 2015-07-24 17:42:08 UTC
Created attachment 154861 [details]
Shows working state in NetBeans IDE Dev (Build 201507240001)

(In reply to ChrisLE from comment #13)
> I tested it in the latest dev build (201507200001) but this doesn't show it
> to me :/. I added the variable to the team -> git options. I only see the
> branch. Nothing more. Show incoming/outgoing works, when I call it.

@ChrisLE: It works for me. Try to commit something and NB will show you that you are ahead.

See screenshot


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo