Inserting label at specified version

If you are having a problem using Fortress, post a message here.

Moderator: SourceGear

Post Reply
Igor
Posts: 6
Joined: Fri Oct 19, 2007 2:12 pm

Inserting label at specified version

Post by Igor » Fri Oct 19, 2007 2:19 pm

in my automated build application I use Fortress API to insert a label after a build. Now I have a label from which I did the build and it of course has a version. Now I want to insert a new label right above the Build label. I use Label function, passing it folder, label, and version. It labels folder with correct version, but the label appear on top, as most recent label. I actually need API to insert the label right after the Build label. Is that possible?

Thanks

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Post by Beth » Mon Oct 22, 2007 8:15 am

I'm assuming you are seeing what appears to be out of order in the history?
Can you post a screenshot of what you are seeing?

Igor
Posts: 6
Joined: Fri Oct 19, 2007 2:12 pm

Post by Igor » Mon Oct 22, 2007 8:56 am

Beth, thanks for a reply. I am not sure how to attach an image from my harddrive, but here is some more details:

Yes, the issue is in Show Labels window:

When it comes to labeling Fortress API has 2 functions: Label and RenameLabel. We currently use RenameLabel when we rename label after build. Now since we want to insert label right after specific version, we can use Label function which accepts “version” parameter. The problem is that while it creates the label at the specified version, the label still appears on top, since the labels seem to be ordered by date descending. You can see the build and the label my app created for the build. They have the same version but they do not appear TOGETHER.
Looks like no matter what, if you insert new label, it will have a most recent date and will appear on top. Is there a way to insert a label so that it appears next to another label, e.g. I have a build label and I want to insert "moved to prod" label right next to it. They shoudl have the same version(which is nto a problem) BUT also they shoudl appear next to each other, which is not what is happening, as the Label History is ordered by date

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Post by Beth » Mon Oct 22, 2007 5:28 pm

I made an example here, but I think if you did the same view, you'd see something else, right?
I entered some labels just through the history explorer of the GUI. I made label 3, then label 4, and then made a second label 3 and that appeared before label 4 instead of after it. In this case, for you it would appear after label 4??
Attachments
labels.JPG
labels.JPG (51.15 KiB) Viewed 10129 times

Igor
Posts: 6
Joined: Fri Oct 19, 2007 2:12 pm

Post by Igor » Tue Oct 23, 2007 12:10 pm

Well, i also use versions. So let's say from your screenshot, you put label3 at version 3.
I would call label3 at version 3 as UnitStable(UI label) label. So I would get code using Unit Stable label. Then after I build the code I want to
create another label right next to UnitStable label (or Label 3 version 3 in your screenshot) to indicate that I did a build on US label
So then I use Label function of Fortress API and pass it label name = "Build", version =3. I expect it to insert the label right above the last version 3, or right above your Label version3 label. Instead
it inserts right on top of everything. But it does have Version 3 in the label. Does that make sense?

Igor
Posts: 6
Joined: Fri Oct 19, 2007 2:12 pm

Post by Igor » Tue Oct 23, 2007 12:14 pm

so to clarify more, for me the last label would appear on top of everything because it has the latest date

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Post by Beth » Tue Oct 23, 2007 1:28 pm

No, it should appear by the version you placed it on. I went back to my previous example and added more labels today (please pardon that some of my labeling is off on what I called it). The ones from today have the word 'Tuesday' in them. You can see though the date is different that they still put them by the version the label occurred at. Are you maybe sorting by date?
Attachments
labels2.JPG
labels2.JPG (60.08 KiB) Viewed 10103 times

Igor
Posts: 6
Joined: Fri Oct 19, 2007 2:12 pm

Post by Igor » Wed Oct 24, 2007 8:36 am

Yes, it looks like Show Labels window is sorted by date and I do not see a way to sort by anything else. When I click on column headings it does not sort. Is this set in osme config file? Also what is your screen sorted by? It does not look like it is sorted by version of by date

thnaks

Igor
Posts: 6
Joined: Fri Oct 19, 2007 2:12 pm

Post by Igor » Wed Oct 24, 2007 8:40 am

Also here is the code I use to label:

private string Label(string folderToLabel,string version, string label)
{

string url = System.Configuration.ConfigurationSettings.AppSettings.Get("FortressServer");
string username = System.Configuration.ConfigurationSettings.AppSettings.Get("UserName"); ;
string password = System.Configuration.ConfigurationSettings.AppSettings.Get("Password");
string repository = System.Configuration.ConfigurationSettings.AppSettings.Get("Repository");

try
{
// Set the login options and login/connect to a repository.
ServerOperations.client.LoginOptions.URL = url;
ServerOperations.client.LoginOptions.User = username;
ServerOperations.client.LoginOptions.Password = password;
ServerOperations.client.LoginOptions.Repository = repository;
ServerOperations.Login();

ServerOperations.ProcessCommandLabel(itemToLabel,label,Convert.ToInt32(version));
ServerOperations.Logout();

}
catch (Exception ex)
{
return ex.Message;
}
return "";
}

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Post by Beth » Wed Oct 24, 2007 3:32 pm

Igor wrote:Yes, it looks like Show Labels window is sorted by date and I do not see a way to sort by anything else. When I click on column headings it does not sort. Is this set in osme config file? Also what is your screen sorted by? It does not look like it is sorted by version of by date

thnaks
Mine is by the order of the actions. Even though they happened at different times, I went into history, and inserted some things in the middle. For example, I checked in Test1a.txt. That makes the folder go to version 4. Normally, the folder version wouldn't show except I went to that folder version and then labeled it after the fact. It would have that label at the same point in time where it acquired that version.

When you first run a show history, there is a sort tab, and there is where you set the sort order.

Post Reply