{"id":1674,"date":"2017-12-05T12:00:49","date_gmt":"2017-12-05T12:00:49","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=1674"},"modified":"2025-02-01T22:39:36","modified_gmt":"2025-02-01T22:39:36","slug":"perforce-lable-using-changelist-number-or-date-time","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/perforce-lable-using-changelist-number-or-date-time\/","title":{"rendered":"Perforce Lable using changelist number or Date\/time"},"content":{"rendered":"<p><strong>scmuser created the topic: Perforce Lable using changelist number or Date\/time<\/strong><br \/>\nHi,<\/p>\n<p>I am trying to create a label using Perforce specific change list number or depends on Data and time for entire branch. Could you please help me with it?<\/p>\n<p><strong>scmuser replied the topic: Re: Perforce Lable using changelist number or Date\/time<\/strong><br \/>\nWw need to understand some of the basic stuff which will help us to resolve this all the time&#8230;.<br \/>\nTo create a label, we will have perform 2 activities &#8211;<br \/>\n1. Create a Name of the Lable using following command&#8230;<br \/>\np4 label <label_name><\/p>\n<p>2. Sync this lable with client workspace source code.<br \/>\np4 labelsync -l <label_name><\/p>\n<p>this means labelsync will only add the client workspace soruce code to the specific label name. so its completly depends on us what source code we have in our client workspace if not head revsion, then we sync perforce source code via many following ways such as&#8230;.<br \/>\n1. p4 sync file.c#4<br \/>\n2. p4 sync \/\/depot\/proj1\/&#8230;@21<br \/>\n3. p4 sync @labelname<br \/>\n4. p4 sync @labelname,@labelname<br \/>\n5. p4 sync @2001\/06\/24<br \/>\n6. p4 sync \/\/depot\/proj1\/&#8230;@2001\/06\/24<\/p>\n<p><strong>rajeshkumar replied the topic: Re: Perforce Lable using changelist number or Date\/time<\/strong><br \/>\nThere are 2 kinds of labels.<\/p>\n<p>1. Static Labels which explain above<br \/>\n2. Automatic Labels, Details and solution can be found below;<\/p>\n<p>You can use automatic labels to specify files at certain revisions without having to issue the p4 labelsync command.<\/p>\n<p>To create an automatic label, fill in the Revision: field of the p4 label form with a revision specifier. When you sync a workspace to an automatic label, the contents of the Revision: field are applied to every file in the View: field.<\/p>\n<p>Example: Using an automatic label as an alias for a changelist number<br \/>\nEarl is running a nightly build process, and has successfully built a product as of changelist 1234. Rather than having to remember the specific changelist for every night&#8217;s build, he types p4 label nightly20061201 and uses the label&#8217;s Revision: field to automatically tag all files as of changelist 1234 with the nightly20061201 label:<br \/>\nLabel: nightly20061201<br \/>\nOwner: earl<br \/>\nDescription:<br \/>\nNightly build process.<br \/>\nOptions: unlocked<br \/>\nView:<br \/>\n\/\/depot\/&#8230;<br \/>\nRevision:<br \/>\n@1234<\/p>\n<p>The advantage to this approach is that it is highly amenable to scripting, takes up very little space in the label table, and provides a way to easily refer to a nightly build without remembering which changelist number was associated with the night&#8217;s build process.<\/p>\n<p>Example: Referring specifically to the set of files submitted in a single changelist.<br \/>\nLabel: patch20061201<br \/>\nOwner: earl<br \/>\nDescription:<br \/>\nPatch to 2006\/12\/01 nightly build.<br \/>\nOptions: unlocked<br \/>\nView:<br \/>\n\/\/depot\/&#8230;<br \/>\nRevision:<br \/>\n@1238,1238<\/p>\n<p>This automatic label refers only to those files submitted in changelist 1238.<\/p>\n<p>Example: Referring to the first revision of every file over multiple changelists.<\/p>\n<p>You can use revision specifiers other than changelist specifiers; in this example, Earl is referring to the first revision (#1) of every file in a branch. Depending on how the branch was populated, these files could have been created through multiple changelists over a long period of time:<br \/>\nLabel: first2.2<br \/>\nOwner: earl<br \/>\nDescription:<br \/>\nThe first revision in the 2.2 branch<br \/>\nOptions: unlocked<br \/>\nView:<br \/>\n\/\/depot\/release\/jam\/2.2\/src\/&#8230;<br \/>\nRevision:<br \/>\n&#8220;#1&#8221;<\/p>\n<p>Because Perforce forms use the # character as a comment indicator, Earl has placed quotation marks around the # to ensure that it is parsed as a revision specifier.<br \/>\nRegards,<br \/>\nRajesh Kumar<br \/>\nTwitt me @ <a href=\"http:\/\/twitter.com\/RajeshKumarIn\" target=\"_blank\" rel=\"noopener\">twitter.com\/RajeshKumarIn<\/a><\/p>\n<p><strong>rajeshkumar replied the topic: Re: Perforce Lable using changelist number or Date\/time<\/strong><br \/>\nTo create a label using datetime requires the use of static labels. What you do is to do a &#8220;p4 sync&#8221; to a specific time, such as:<\/p>\n<p>p4 sync @2011\/03\/18<\/p>\n<p>Then tag the files with a label:<\/p>\n<p>p4 tag -l <labelname> \/\/depot\/&#8230;<\/p>\n<p>For more information, please refer to the Perforce User Guide:<\/p>\n<p><a href=\"http:\/\/www.perforce.com\/perforce\/r10.2\/manuals\/...odemgmt.html#1066766\" target=\"_blank\" rel=\"noopener\">www.perforce.com\/perforce\/r10.2\/manuals\/&#8230;odemgmt.html#1066766<\/a><br \/>\n<a href=\"http:\/\/www.perforce.com\/perforce\/r10.2\/manuals\/...odemgmt.html#1081816\" target=\"_blank\" rel=\"noopener\">www.perforce.com\/perforce\/r10.2\/manuals\/&#8230;odemgmt.html#1081816<\/a><br \/>\nRegards,<br \/>\nRajesh Kumar<br \/>\nTwitt me @ <a href=\"http:\/\/twitter.com\/RajeshKumarIn\" target=\"_blank\" rel=\"noopener\">twitter.com\/RajeshKumarIn<\/a><\/p>\n<p><strong>rajeshkumar replied the topic: Re: Perforce Lable using changelist number or Date\/time<\/strong><br \/>\nOne more important things is that &#8211;<br \/>\nThe automatic label (the &#8220;Revision:&#8221; field in the label<br \/>\nspecification) was introduced in version 2006.2:<\/p>\n<p>Major new functionality in 2006.2<\/p>\n<p>&#8216;Automatic&#8217; labels &#8211; #107125 (Bug #20887) **<\/p>\n<p>The new automatic label feature introduced in 2005.2 but<br \/>\nundocumented is now fully supported. By adding a &#8220;Revision&#8221;<br \/>\nfield to the label specification you can now make that label<br \/>\nappear as if &#8216;p4 labelsync&#8217; had been done on the label using<br \/>\nthat revision. The only difference is that if the &#8220;Revision&#8221;<br \/>\nspecification is dynamic (e.g #head) the apparent contents of<br \/>\nthe automatic label will change, while a static label set with<br \/>\n&#8216;p4 labelsync&#8217; will not. Note that when executing the command<br \/>\n&#8216;p4 labels <filespec>&#8216; automatic labels will not be displayed.<\/p>\n<p>(<a href=\"http:\/\/www.perforce.com\/perforce\/r10.2\/user\/relnotes.txt\" target=\"_blank\" rel=\"noopener\"> www.perforce.com\/perforce\/r10.2\/user\/relnotes.txt<\/a> )<br \/>\nRegards,<br \/>\nRajesh Kumar<br \/>\nTwitt me @<a href=\"http:\/\/twitter.com\/RajeshKumarIn\" target=\"_blank\" rel=\"noopener\"> twitter.com\/RajeshKumarIn<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>scmuser created the topic: Perforce Lable using changelist number or Date\/time Hi, I am trying to create a label using Perforce specific change list number or depends on Data and&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[370],"tags":[373],"class_list":["post-1674","post","type-post","status-publish","format-standard","hentry","category-perforce","tag-perforce"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/1674","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=1674"}],"version-history":[{"count":1,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/1674\/revisions"}],"predecessor-version":[{"id":1675,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/1674\/revisions\/1675"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=1674"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=1674"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=1674"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}