Why merging changes between labels for specific file not working? - perforce

Assume I have two branches UK_SYS and ASIA_SYS (related but not coming from a simple copy/integrate from common ancestor), e.g.
[UK_SYS/branches/v1.0]
-----------#-----------#-----------#------>
#uk-1.0 #uk-1.0.1 #uk-1.0.2
[ASIA_SYS/branches/v1.0]
-----------#-----------#------------------>
#asia-1.0 #asia-1.0.1
There are changes from a specific file (say, foo.txt) from UK_SYS #uk-1.0 to #uk-1.0.1 that I want to bring to ASIA_SYS.
In P4V, I am clicking on foo.txt, and click Merge/Integrate.
I specified //depot/UK_SYS/branches/v1.0/foo.txt as Source file/folders, and //depot/Asia_SYS/branches/v1.0/foo.txt as Choose target files/folders.
In Options -> Filter, I specified Revisions from/to and put From as Label, uk-1.0 and To as Label, uk-1.0.1
However, when I click on Merge or Preview, P4V complains me for The operation cannot be completed because you cannot limit to and from a label. I have no idea why it does not work as it should essentially means "Find the changes of //depot/UK_SYS/branches/v1.0/foo.txt, between file revision labelled at #uk-1.0 and file revision labelled at #uk-1.0.1. Then merge the change to //depot/ASIA_SYS/branches/v1.0/foo.txt".
If I manually find out the file revision of foo.txt using the label #uk-1.0 and #uk-1.0.1, and use the revisions as From/To, it seems working (either one will already work), but it is tedious to do the same for a bunch of files.
What is the appropriate way to do such merging? (P4V client I am using is dated 2015 Feb 04, Rev. Perforce Visual Client/NTX64/2014.3/998867)

Related

Perforce file(s) not on client view

i was hoping someone could point me in the right direction? I am trying to set up a second depot, but whenever i try adding files it will spit out this message ' not in client view'.
The primary depot is up and running fine for a unreal project, but i can't figure out how to set up a second one. I made sure to exclude the primary depot tree when creating a new workspace and also made sure to point it to the correct workspace directory.
Your client view defines which depot files are mapped to your workspace, and where they're mapped to. If your client view looks like:
Root: C:\Perforce
View:
//apples/... //your-client/apples/...
//pears/... //your-client/pears/...
both the apples and pears depots are mapped to your workspace as follows:
//apples -> C:\Perforce\apples
//pears -> C:\Perforce\pears
If you try to add a local file that is not in either of those locations, you will get an error:
C:\Perforce>p4 add gravenstein.jpg
gravenstein.jpg - file(s) not in client view.
This is because according to your View, that file doesn't belong in either depot. You need to put the file in a location that you've mapped so that Perforce can figure out which depot (and which directory) it goes in.
C:\Perforce>move gravenstein.jpg apples
1 file(s) moved.
C:\Perforce>p4 add apples\gravenstein.jpg
//apples/gravenstein.jpg#1 - opened for add
In your comment, you mentioned removing "the extra part". Suppose you changed your View to look like:
Root: C:\Perforce
View:
//apples/... //your-client/apples/...
//pears/... //your-client/...
Now your client root maps directly to the pears depot, and the apples depot is no longer mapped anywhere!
C:\Perforce>p4 add pippin.jpg
//pears/pippin.jpg#1 - opened for add
C:\Perforce>p4 add apples\honeycrisp.jpg
//pears/apples/honeycrisp.jpg#1 - opened for add
This is because later lines always take precedence. By flipping the order of the View lines you can make it so that most of the workspace is mapped to pears, but there's an exception for the local apples directory:
View:
//pears/... //your-client/...
//apples/... //your-client/apples/...
C:\Perforce>p4 add bartlett.jpg
//pears/bartlett.jpg#1 - opened for add
C:\Perforce>p4 add apples\granny_smith.jpg
//apples/granny_smith.jpg#1 - opened for add
However, I'd usually recommend that parallel depot paths (e.g. two top-level depots) be represented by two parallel local directories (the default) rather than nesting them inside each other -- it makes it easier to reason about what file goes where if the depot and the workspace mirror each other as much as possible. Just remember that you need to put local files in the directory that goes with the depot you want to add them to.

Get specific Version from Source control

I have 34 word templates in TFS and I'm suing VS2012.
Only 32 have been modified and saved under a change set.
I wanted to just extract those modified by that change set.
I made sure my mapped folder was empty before I started.
I used Advanced/Get Specific and then did a get using the changeset number
However, all 34 templates were downloaded into my folder.
The changeset get seems to get all files modified before and up to the change set I requested.
In my case I can pick out the 2 files and remove them. But if I had hundreds of files spread over a dozen folder it would be a nightmare.
Is there a way to get only those files modified by a specific changeset files ?
"Get Specific" means getting all the files as how they were at the time when ChangeSet was created. It doesn't mean getting only changed files.
Since you are using VS 2012, you could use Team Foundation Power Tools' tfpt GetCS command:
The GetCS tool retrieves all items listed in a changeset for a
given changeset version.
This is useful when a co-worker checks in a change that you need to
have in your workspace, but you cannot upgrade your entire workspace
to the latest version. Use the GetCS tool to get just the items
affected by your co-worker’s changeset. You can do this without
inspecting the changeset to manually list the changed files when using
a getcs command.
There is no graphical user interface for the GetCS tool. To invoke
the GetCS, type the following command. The parameter
changesetnum specifies the changeset number.
tfpt GetCS /changeset:changesetnum

File Attachment inside P4 Changelists

I'm looking for a way to embed file attachments (like screenshots) inside a Perforce changelist. I'm hoping (but not optimistic) that there's a way inside P4 to actually do this, possibly via a plugin.
If not, I'll either have to look into writing a plugin myself (any pointers?), or I have to cook up a wrapper for P4 checkins that also uploads/submits the attachment, then links that attachment to the CL via an identifier inside the CL. (And then I need a tool to correlate and display both).
To add a bit more information: I'm interfacing with the P4 server via a P4API bot that I'm writing. That bots crawls over every checkin and harvests the data it gets to generate reports. I.e. it correlates submissions with the actual feature spec that informed the task, generates a history of progress for that task etc. Within that context, attaching additional meta data to a CL (like a screenshot) is useful because those attachments can then be used in the data mining - they can enhance the reports that I'm generating.
I can guard against bad/rampant metadata attachments via a wrapper program that is used to make 95% of all our P4 submissions, anyway (it has its own dialog). But I gotta figure out how to present all the data inside P4 when the P4 CL spec only seems to have text available.
I don't think there is any (easy) way to do what you're requesting. A changelist is "an atomic change transaction". There is very little meta-data with them. The P4 command reference for p4 change lists everything you're allowed to do, and adding an arbitrary attachment isn't there.
You could always open a feature request in the Perforce forums.
In Response to Edits
It looks like this is actually just one instance of a larger problem you're facing: managing meta-data around your depot's projects and its changelists. I would suggest you use this requirement as a driving force behind making some larger process changes at your organization. If you have a lot of data being generated based on automated analysis of your projects, it would be better to create a proper database to organize it all. Your submission wrapper could handle putting screenshots (or any other meta data) in a database and annotating the change list description with tags that indicate where to find attachments in the database.
A comprehensive database solution would allow you to associate attachments, changelists and other data with each other and other project resources in a more organized fashion than you currently have.
Original Response
If you decide to write a plugin to handle just this task without a database, my suggested approach would be the following:
Designate a shared network drive or directory that is accessible to all team members as the "perforce attachment dump". Users should have write access to this area.
Use the changelist description field to create a tag to name a file that should be attached. For example, "Attach: file_name.jpg".
Your users use the plugin to navigate to the file(s) locally and the plugin will copy it to the dump drive and add the tag to the description. The plugin should enforce some naming scheme to make the files easy to find. Perhaps append the changelist number to the file base name? Or create a folder for each changelist?
Use a server side pre-submit trigger and script to scan submitted changelist descriptions for tags and retrieve this file from the attachment dump. It should probably reject changelists with the tag if it can't find the file.
The server side script should move the file to a share drive that is read-only to users. This is so that if you want to look at an attachment for a changelist that is five months old, you can be sure it will still be available.
Give your plugin the ability to open the attachments on the read-only share drive from your developer's local machines, from within P4 and P4V.

Perforce to ignore revision during integrations

I have created feature branch for one of our projects, and deleted all documentation files there in one changelist. (I know, bad idea).
I want to integrate back everything except given changelist, I tried following to ignore it:
p4 integrate //branch/...#CL,CL //main/...
p4 resolve -at //main/...
However, the files still remain marked for deletion - the resolve ends with
//main/... - no file(s) to resolver.
Is there any way how to tell perforce that given CL is already integrated and ignore it in subsequent integrations?
Note that you need at least a 2011.1 server to do this (if your server is older you'll get an error message on the integrate):
p4 integrate -Rd //branch/...#CL,CL //main/...
p4 resolve -ay
The "-Rd" flag says that files which would normally be opened for delete automatically should be opened for integrate and scheduled for resolve instead. In turn, the "p4 resolve -ay" will say that you want to keep what's in your workspace (an "integrate" with no content change) and submit that as the final result.
The submitted "integrate" revisions will record that you have done this integration (the history will show an "ignore" of the deleted revisions in your branch), but without actually changing the contents of the submitted files.
If you use the "p4 merge" command instead of the "p4 integrate" command (with a more current server version, I think 2013.1 or thereabouts), all files are scheduled for resolve automatically (i.e. including those that would previously have been automatically opened for branch or delete), so with "p4 merge" you always must resolve (and may optionally ignore) any source change.
Relevant p4 blog entries:
http://www.perforce.com/blog/110620/ignoring-branches-deletes
http://www.perforce.com/blog/130812/resolve-face-adversity
It seems like you wanted 'resolve -ay' here, not 'resolve -at'. When integrating back to main, I think that "theirs" is the branch, while "yours" is main.
From 'p4 help resolve':
The resolve process is a classic three-way merge. The participating
files are referred to as follows:
'yours' The target file open in the client workspace
'theirs' The source file in the depot
'base' The common ancestor; the highest revision of the
source file already accounted for in the target.
'merged' The merged result.
Filenames, filetypes, and text file content can be resolved by
accepting 'yours', 'theirs', or 'merged'. Branching, deletion, and
binary file content can be resolved by accepting either 'yours' or
'theirs'.

Perforce streams, exclude files from merge/copy

I have following perforce streams structure: main branch and 2 development branches linked to it dev_v1 and dev_v2. Both development streams has some build control files where version specific variables are located. Any change in these files will be reflected in Perforce Streams Graph and the system will ask me to merge them into main and then from main into other development branch.
How to exclude specific set of files in Perforce so that in case of any change the system will no show any difference between streams and will not ask to merge/copy them.
If those build files should never be integrated you should set that path in the stream view to be 'isolate' instead of public. That will add the files to client views for that stream, but will exclude them from any generate branch maps. That will cause them to fall out of the integration calculation and Perforce will stop trying to integrate them.
Isolate was specifically put in streams to handle build files that are unique to each stream, so this is the perfect use.
When you merge you can select which change lists you want to include in the merge, and which you want to exclude. If you are using P4V when you get into the merge window you can choose which changelists to merge into the other code line. Most of our items are set up as streams...if you are a using a standard depot the functionality to should be similar...if you have troubles let me know I can set up another depot on my dev server.

Resources