Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 360193

Summary: [client] Checkout by tag support
Product: [ECD] Orion Reporter: Simon Kaegi <simon_kaegi>
Component: GitAssignee: Malgorzata Janczarska <malgorzata.tomczyk>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: john.arthorne, susan, Szymon.Brandys, tomasz.zarna
Version: 0.3   
Target Milestone: 0.3 RC3   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on: 360634, 360641, 360667    
Bug Blocks:    

Description Simon Kaegi CLA 2011-10-06 23:53:22 EDT
I figure I must be missing something but it wasn't at all clear to me how we go about doing a checkout by tag. I was looking all over the repositories page but couldn't figure it out.

The concrete case I was looking at was how to go about checking out the 1.6.1 tag from my clone of https://github.com/dojo/dojo
Comment 1 Szymon Brandys CLA 2011-10-07 12:27:30 EDT
Gosia, please look at it. Talk to Tomek for the missing API and Simon and Susan for possible UI presentations.
Comment 2 Malgorzata Janczarska CLA 2011-10-07 12:31:42 EDT
Tomek, do we have API for this?
Comment 3 Szymon Brandys CLA 2011-10-07 12:35:36 EDT
I talked to Simon a bit about the presentation. One of approaches would be to add the tag node for repos on our git clone view

repository name
|_branches
|_remotes
|_tags
  |_tag1
  |_tag2

and the checkout action for tag object. It looks like the quickest and quite good way to address the bug.
Comment 4 Simon Kaegi CLA 2011-10-07 13:17:34 EDT
re:checkout action for a tag -- into a new local branch... Otherwise we end up in a bizarro disconnected state.
Comment 5 Tomasz Zarna CLA 2011-10-10 03:55:21 EDT
(In reply to comment #2)
> Tomek, do we have API for this?

No, we haven't. I'll put it up asap.
Comment 6 Tomasz Zarna CLA 2011-10-10 07:52:57 EDT
The API is ready[1]. It's similar to checking out a branch, ie call PUT on a clone location with two JSON params [2]:
* Tag, for the tag to checkout.
* Branch, for the branch to create.

There is a limitation in JGit[3] which doesn't allow to checkout a tag into a branch with the same name so please use a different name for the branch. I agreed with Gosia, that for now it's going to be something like "tag_{tag}".

[1] 311101f234f89567d5a668d0e0bb711a7afdffd5
[2] http://wiki.eclipse.org/Orion/Server_API/Git_API#Checking_out_a_tag
[3] http://egit.eclipse.org/r/#change,4336
Comment 7 Malgorzata Janczarska CLA 2011-10-12 10:17:55 EDT
I pushed my changes to origin/bug360193 branch.
Due to bug 360641 and bug 360667 I can't push it to master now, but you can see how it works. Unfortunately due to bug 360641 it doesn't work on our client and server repositories, I've tested it on my github.
It still needs a new icon for "Tags" to created.
Comment 8 Malgorzata Janczarska CLA 2011-10-12 12:01:39 EDT
I've added icon for Tags.
Comment 9 Tomasz Zarna CLA 2011-10-14 06:12:33 EDT
Bug 360641 is very unlikely to be fixed in .3, see the last comment there.

Simon, if you think this is a must have for .3, please re-target. In that case, I will try to find a workaround on our side, not waiting on a fix in JGit.
Comment 10 Simon Kaegi CLA 2011-10-14 10:22:28 EDT
Let's take one day to take a look and then decide -- if egit can do it...
Comment 11 Tomasz Zarna CLA 2011-10-14 11:02:57 EDT
(In reply to comment #10)
> Let's take one day to take a look and then decide -- if egit can do it...

I think we're on the right track to actually fix this. In bug 360641 I did exactly what EGit does - don't bother about parsing an Object to RevTag, be fine with a Ref and use its name as tag name. I've checked out Gosia's branch from comment 7 and it seems to work fine. 

Since it's the endgame, Susan please double check Gosia's changes in the UI.
Comment 12 Malgorzata Janczarska CLA 2011-10-14 13:12:55 EDT
(In reply to comment #11)
> Since it's the endgame, Susan please double check Gosia's changes in the UI.

Susan, I verified that Tomek's fixes work, so could you checkout this branch, to see it this UI is fine? I've added "tags" icon (my own drawing) and added it to the sprite, so please double check if this is fine.
Generally with your green light this feature is good to go.
Comment 13 Susan McCourt CLA 2011-10-14 13:30:32 EDT
(In reply to comment #12)
> (In reply to comment #11)
> > Since it's the endgame, Susan please double check Gosia's changes in the UI.
> 
> Susan, I verified that Tomek's fixes work, so could you checkout this branch,
> to see it this UI is fine? I've added "tags" icon (my own drawing) and added it
> to the sprite, so please double check if this is fine.
> Generally with your green light this feature is good to go.

I'm not seeing a branch called  origin/bug360193 in the git clones view.  Are you sure this branch is in the remote? (or we have some other bug preventing me from seeing this?)
Comment 14 Tomasz Zarna CLA 2011-10-14 13:45:40 EDT
@Susan: Try Fetch on the remote first. I'm able to see the branch in a newly created clone on orion.eclipse.org.
Comment 15 Susan McCourt CLA 2011-10-14 14:06:08 EDT
(In reply to comment #14)
> @Susan: Try Fetch on the remote first. I'm able to see the branch in a newly
> created clone on orion.eclipse.org.

I can see the branch from eclipse.org.
I can't figure out how to fetch the tags/branch info from the remote using the Orion UI.  "Fetch" from git log on remote or git status doesn't do it.  I'm guessing I need "Fetch All."  where is it?
Comment 16 Susan McCourt CLA 2011-10-14 14:10:11 EDT
(In reply to comment #15)
> (In reply to comment #14)
> > @Susan: Try Fetch on the remote first. I'm able to see the branch in a newly
> > created clone on orion.eclipse.org.
> 
> I can see the branch from eclipse.org.
> I can't figure out how to fetch the tags/branch info from the remote using the
> Orion UI.  "Fetch" from git log on remote or git status doesn't do it.  I'm
> guessing I need "Fetch All."  where is it?

opened bug 361017 to discuss this.  I recall having this problem long ago and had to use command line to fetch in order to see the branches.
Comment 17 Susan McCourt CLA 2011-10-14 15:19:39 EDT
Reviewed source code and tried the new UI.
Note that running an inner site from today's Orion eclipse.org build doesn't contain Tomek's fix for bug 360641, so I couldn't verify it for the eclipse repos.  But I was able to tag one of my github repos and then create a local branch based on that tag.

I also verified that if you try to reuse a branch name you get a reasonable error message.

I didn't +1 it because it doesn't seem to work if you don't type a new branch name.  For example, you get the edit box with "Branch name" and if you just hit enter, nothing seemingly occurs.  No new branch.  I think instead the edit box should default to use the tag name, so I can just hit enter and the right thing will happen for me.

While trying to figure out what went wrong in the above scenario, i was able to get detached at some point, but I think I might have deleted the original tag by accident.

I'm ok to release this code if we can make the default case (push checkout, it proposes a good default name, hit enter, and it works).
Comment 18 Malgorzata Janczarska CLA 2011-10-17 07:24:23 EDT
(In reply to comment #17)
> I'm ok to release this code if we can make the default case (push checkout, it
> proposes a good default name, hit enter, and it works).

I released this change today, so I understand it as green light to merge it to master.
Comment 19 Susan McCourt CLA 2011-10-17 11:54:22 EDT
(In reply to comment #18)
> (In reply to comment #17)
> > I'm ok to release this code if we can make the default case (push checkout, it
> > proposes a good default name, hit enter, and it works).
> 
> I released this change today, so I understand it as green light to merge it to
> master.

yep.  thanks.