Jump to content

Problems with Xlinks and Branches?


sbrassard

Recommended Posts

Is it possible to switch between branches while using xlinks? So, far my attempts at doing so, have failed multiple times miserably ending in errors in the plastic UI.

So, here we go:

1) Create 2 repositories: Project1 and Library1.

2) Create 2 workspaces (at c:\plasticworkspaces): Project1 and Library1

3) Create a new text file at Project1 named "project1.txt" and enter any text "First revision, CS1", and then check the file in

4) Create a new folder called "Controls" in the Library1 workspace and create a new text file inside the Controls folder called "controls.txt", and enter any text, "First revision, CS1" and check the file in.

5) Create a folder named "Library1" under your Project1 workspace (this will be the target for the xlink we will create)

6) Open up a command window, CD to the c:\plasticworkspaces\Project1 folder and issue the command:

cm xlink -w Library1 / cs:1@Library1@localhost:8087

7) Close the command window, and within the plastic ui, click the tab "Project1" and click "Pending Changes" action, checkin the xlink'ed folder you just created.

8) From the Project1 tab, select "Items" action and right click the top most item (which should be the folder designating the "c:\plasticworkspaces\Project1" workspace) and click Update. Now your Library1 folder (xlink) under the Project1 workspace has been updated to include the Controls folder and controls.txt file from the Library1 repository.

9) Lets make another change to the controls.txt, so check it out, make a change and then check it back in (so we can verify that the xlinks are working properly). This should check the file in on the main branch for the Library1 repository.

10) Open Plastic UI and navigate to the Library1 tab, select "BranchExplorer" from actions and you will see another changeset present on the main branch (if you checked in your changes), however, I've noticed that the "Working Changeset" icon (of the house) is still active on CS1, not the latest CS checked in from Project1 (see #9), which should be at CS2 (even after refreshing)

11) Ok, now the fun begins, while in the Library1 tab, inside "BranchExplorer", right click the last changeset (CS2) that was checked in from step #9, and select "Create branch from this changeset".

12) Attempt to switch to this branch in "Library1" tab to make it the active branch. This is where I start to notice all hell breaks loose. I received an error at this point, but cant remember what It said.. (sorry)..something about xlinks and it being locked by a process...

13) If I navigate back to my Project1 tab and view "Items", all items are private and it only shows files from the Library1 repository (ie. Library1 folder and Controls folder). All of my Project1 repository items are missing from the workspace.

So, again, my question is, how does xlinks help me? It sounds like a great feature but its not working for how I need to use it. I would like to create a "link" to another repository, switch between branches in code for the linked repo, and continue developing in Project1. Am I mistaken how xlinks are supposed to work, or is this quite possibly a bug?

In previous Plastic releases (3.0 and prior), I would create repository for both Project1 and Library1, and then (using visual studio) create a solution file that points to the Library1 in the workspace and adding the solution (class library project) to my Project1 solution. This seemed to work better because I could use plastic to switch branches all day long (as long as I didn't switch branches from within visual studio), and everything seemed to work. So, I'm not sure how xlinks makes this any better if I cant switch between branches correctly.

Sorry for the long winded diatribe, but hopefully someone can either correct me, or show me how to get this to work. It would also be great if the 4.0 documentation could be released soon, since these features are not yet documented anywhere except for a single blog entry on plasticscm.com.

Thanks,

Steve

Link to comment
Share on other sites

UPDATE - I think I figured out why in #13 my Project1 items where showing only the items in the Library repository. It so happens that I may have right clicked on "Library1" folder in the Project1 workspace and selected BranchExplorer and switched my branch there. I did this after trying to switch branches from the Library1 repo BranchExplorer to only find out that it didnt work, and then attempted to try it within the Project1 BranchExplorer.

Even when trying to "switch workspace to this branch" (in Library1, switch from /main to /testbranch), then, attempting to update my Project1 files with latest repository files, edit the controls.txt from the Project1 workspace and checking it in... it appears as though the check-in will create a new changeset on the /main branch of Library1 repository, even when the active branch is /testbranch. I'm confused.

Something does not appear to be working correctly with xlinks and branches, unless i'm using it incorrectly. Anyone have a solution or have a step by step to get branches working with xlinks?

Link to comment
Share on other sites

Hi sbrassard,

I think you don't have some concepts clear. For example at step 10, the working changeset was on changeset 1 and not in changeset 2 due to the Library1 workspace was not updated.... since you were working on Project1 workspace.

You have to distinguish between workspace and repository, the workspace in a representation of a repository snapshot, so if you are working in the Project1 main branch (Project1 repository) and you create a change under a Xlink (pointing to a changeset inside 'Library1' main branch) plastic will create a new changeset on 'Library1' repository to store the change and another changeset on 'Project1' repository to store the new Xlink pointer to be loaded.

I propose you to do the following:

1) Repeat the steps from #1 to #10

2) Create a branch '/main/scm001' in 'Project1' repository from the last changeset of main branch.

3) Switch to it.

3) Create a change under the xlink content -> see what happens in 'Library1' repository. (Auto-created branch + changeset stored inside it)

4) Create a change outside of the xlink content, for example the 'project1.txt' file -> see what happens in 'Library1' repository (nothing)

5) Switch again to 'Project1' library -> try to merge from the '/main/scm001' branch -> see the result.

You will see that the 'Library1' repository is going to evolve as you perform actions under the Xlink.

Feel free to ask if you have question!

Manu.

Link to comment
Share on other sites

Hi Guys,

I'm getting a similar issue.

I have three repositories: Libraries, Products and Dev.

I have a Libraries_wkp workspace that works on the Libraries repository

I have a Dev_wkp workspace that works on the Dev repository.

From Libraries_wkp I imported some code for my libraries and labeled it.

So I have 1 changeset in the Libraries repository and none in the Products repository.

In Dev_wkp I've created 2 xlinks using:

cm xlink -w Libraries / cs:1@Libraries@192.168.1.101:8087

cm xlink -w Products / cs:0@Products@192.168.1.101:8087

In Dev_wkp I checked in the two new folders. I can see my Products folder empty as it should be and my Libraries folder with the imported code.

From Dev_wkp I then imported some more code for my libraries and labeled it.

From Dev_wkp I imported some code for my products and labeled it. No problem.

So I now have 2 changesets in the Libraries repository and 1 in the Products repository.

In Libraries_wkp I ran an update and I saw my new version of the libraries selected. It's all good. It's now pointing to the latest changeset (#2) of the Libraries.

Then in Libraries_wkp I imported a new version of my libraries and labeled it. Therefore creating a changeset #3.

In Dev_wkp I then ran an update expecting to see changeset #3 of my Libraries. But I still see selected the changeset #2 of Libraries even though changeset #3 is the latest in the Libraries repository.

When I run the 3D history on one of Libraries elements from Dev_wkp I see all its changesets (#2 and #3) but the selected one is #2 not #3 as expected.

When I run the 3D history on the same Libraries elements from Libraries_wkp I see all its changesets (#2 and #3) and the selected one is #3 as expected.

BTW, all of this occured in the main branch.

Did I do anything wrong or is this a defect?

BTW, how I can see the different revisions of an element (not a changeset) and the labels potentially applied to some of them?

Because when I click 'view history' on an item, I can see the list of changesets it belongs to, but in the labels column I never see any label, as if I neve applied any. I have no more luck using the 3D history.

Thanks for your help.

-Laurent.

Link to comment
Share on other sites

Hi Laurent!

you were working right until this:

Then in Libraries_wkp I imported a new version of my libraries and labeled it. Therefore creating a changeset #3.

If you modify the linked repository outside the xlink (using the Libraries_wk and not the Dev_wk) the xlink is not able to detect the change... you have to do it using the Dev_wk and modifying the Libraries code under the xlink, in this way the change will be propagated to your Libraries repository and the xlink will be updated aotomatically.

The idea is that once you have the external repositories Xlinked you do all the operations using the repository that has the Xlinks to external reps, in this way the 3 repositories will evolve together.

BTW, how I can see the different revisions of an element (not a changeset) and the labels potentially applied to some of them?

Because when I click 'view history' on an item, I can see the list of changesets it belongs to, but in the labels column I never see any label, as if I neve applied any. I have no more luck using the 3D history.

Yes, we know this issue, we will try to develop the functionality from 4.X series. It's a thing we want to have back.

Manu.

Link to comment
Share on other sites

Thanks Manu.

I'm not sure I understand the logic behind this constraint and I may see a legitimate need with my way of trying to do things. But I reserve my judgement until I hear answers to the following questions: :)

- What if I had created my link without the -w option? I would have had then to update my Libraires from Libraires_wkp. Would I have the same problem then with the latest version not showing up on the Dev_wkp side?

- Or does it mean that once a repository is accessed through a link, it should always be accessed through a link?

- Can I have multiple workspaces in paralellel with a link to the same Libraries and update the Libraries from these different workspaces? Would that work? This question has two folds:

- different workspaces on different repositories for same user

- different workspaces on same repository for different users

Can I fix the issue I currently have now by checking in everything in Dev_wkp and then deleting the link to the Libraries from my Dev_wkp and then running 'cm xlink -w Libraries / cs:3@Libraries@192.168.1.101:8087'?

Or is the a way to simply update a link, kind of like a rebase and tell it to use changeset #3 as its base instead of #1?

-Laurent.

Link to comment
Share on other sites

Hi Laurent,

- What if I had created my link without the -w option? I would have had then to update my Libraires from Libraires_wkp. Would I have the same problem then with the latest version not showing up on the Dev_wkp side?

In this case the Xlink will be a read-only Xlink and you will not be able to checkout elements under the checkin. If your read-only Xlink is pointing to your cs:1@Libraries it will be pointing to this changeset forever, if you don't remove/edit it manually, obviously.

- Or does it mean that once a repository is accessed through a link, it should always be accessed through a link?

No, you can work with your Library repository as you want, if you use it through Xlinks you have the advantage of the auto-created branches, auto-merge, auto-ci, auto-all. (Using a writable Xlink).

- Can I have multiple workspaces in paralellel with a link to the same Libraries and update the Libraries from these different workspaces? Would that work? This question has two folds:

- different workspaces on different repositories for same user

- different workspaces on same repository for different users

You can have as many workspaces as you want, the workspace is only a representation of a repository snapshot/configuration, you can have a workspace working on the /main branch, you can have a workspace working on the /main/task001 branch and you can have a workspace switching between /main and /main/task001 branches.

So:

Yes, you can have different workspaces on different repositories for same user.

Yes, you can have different workspaces on same repository for different users.

Can I fix the issue I currently have now by checking in everything in Dev_wkp and then deleting the link to the Libraries from my Dev_wkp and then running 'cm xlink -w Libraries / cs:3@Libraries@192.168.1.101:8087'?

Or is the a way to simply update a link, kind of like a rebase and tell it to use changeset #3 as its base instead of #1?

You can edit a Xlink using the "-e" parameter, the usage of the command is the same as if you were creating a new xlink.

Manu.

Link to comment
Share on other sites

Manu,

Thanks for all the great information and clearing up a few things regarding my original request. It appears as though you were correct (although, I never doubted you). Here we go:

I created Project1 repository and Library1 repository, created an XLINK inside of Project1 which links Library1 repository (on a specific changeset). All is good. I started working and branching code in Project1, created changes to Library1 source code under my new (Project1) branch and checked in changes. I switched over to Library1 BranchExplorer and noticed that a new branch was also "magically" created in Library1 repository that reflected my changes in my Project1 branch. Coolness.

So, now I have another issue.

When I created my XLINK for Library1 inside Project1, my XLINK was set to apply to cs:1@Library1 (using -w also). In the meantime, I created a Project2, and an XLINK to link to Library1 using the latest changeset (lets use cs:5 for example) cs:5@Library1 (using -w also). You probably already know where I'm going with this.

So, for Project1, using Library1 (cs:1), I make changes to code... and then attempt to check them in. Then I get the "User action is required at checkin" window to appear, "Other changes have been checked in while you were making your changes. A merge is needed in order to continue. How would you like to proceed?"

I am presented with making a choice of "Merge now" or "Merge later (checkin my changes in a child branch". So I try merging now... and the Merge window appears, but doesn't display any action items for the merge to work. "The merge search has finished. No merges have been detected". I can try changing all the merge options, but that didn't seem to work.

So, what is the correct way to work with this kind of merge? Remember, my Project1 XLINK to Library1 was created using cs:1, so, why isnt it smart enough to update that link and complete the merge with the latest code modified in Library1 which was also linked in Project2 using cs:5?

Help me understand this. (also, when will the documentation be released?)

Thanks,

Steve

Link to comment
Share on other sites

Hello sbrassard,

that's a limitation of the Xlinks, the "merge now" feature is not available yet.

We have to do it... :P

Here in Codice we all work always using the "Task per branch" methodology and each developer has his own branch per task, only one developer per branch/task, so we avoid this problem working in this way. (This is not an excuse, we are going to develop the missing functionality).

Link to comment
Share on other sites

that's a limitation of the Xlinks, the "merge now" feature is not available yet.

We have to do it... :P

Do you have an idea as of when this feature will be available?

Here in Codice we all work always using the "Task per branch" methodology and each developer has his own branch per task, only one developer per branch/task, so we avoid this problem working in this way. (This is not an excuse, we are going to develop the missing functionality).

Can you walk me through how I can merge this back in correctly using Task per branch and xlinks? I believe I tried this a few times and it didnt work. So, I have Project1 linked to Library1 on CS:1 and Project2 linked to Library1 on CS:5. I start modifying code in Project1 under my xlink Library1. How do I get this change checked in (merged) using a branch and have my Library1 xlink'ed folders source in Project1 update to reflect the merge with the latest changeset, currently at CS:5 (which may have been added using Project2). Please be as specific as you can.

Thanks,

Steve

Link to comment
Share on other sites

  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...