{"id":374,"date":"2014-09-22T00:00:00","date_gmt":"2014-09-22T00:00:00","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/2014\/09\/22\/interview-questions-and-answer-for-perforce-version-control-tool\/"},"modified":"2025-02-01T22:39:41","modified_gmt":"2025-02-01T22:39:41","slug":"interview-questions-and-answer-for-perforce-version-control-tool","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/interview-questions-and-answer-for-perforce-version-control-tool\/","title":{"rendered":"Interview Questions and Answer for Perforce Version Control Tool"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3543 aligncenter\" src=\"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2014\/09\/perforce-interview-question.png\" alt=\"perforce-interview-questions-answers\" width=\"600\" height=\"400\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2014\/09\/perforce-interview-question.png 600w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2014\/09\/perforce-interview-question-300x200.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p><strong>Some of the perforce commands which is not commonly used but useful.<\/strong><br \/>\np4 annotate &#8211; <a name=\"1041869\"><\/a>Print file lines along with their revisions.<br \/>\n<a name=\"1048072\"><\/a>e.g p4 annotate file.c<\/p>\n<p><strong>How to ignore files\/folder in perforce workspace\/client?<\/strong><br \/>\nAssuming you have a client named &#8220;CLIENT&#8221;, a directory named &#8220;foo&#8221; (located at your project root), and you wish to ignore all .dll files in that directory tree, you can add the following lines to your workspace view to accomplish this:<\/p>\n<p>-\/\/depot\/foo\/*.dll \/\/CLIENT\/foo\/*.dll<br \/>\n-\/\/depot\/foo\/&#8230;\/*.dll \/\/CLIENT\/foo\/&#8230;\/*.dll<\/p>\n<p>The first line removes them from the directory &#8220;foo&#8221; and the second line removes them from all sub directories. Now, when you &#8216;Reconcile Offline Work&#8230;&#8217;, all the .dll files will be moved into &#8220;Excluded Files&#8221; folders at the bottom of the folder diff display. They will be out of your way, but can still view and manipulate them if you really need to.<\/p>\n<p>You can also do it another way, which will reduce your &#8220;Excluded Files&#8221; folder to just one, but you won&#8217;t be able to manipulate any of the files it contains because the path will be corrupt (but if you just want them out of your way, it doesn&#8217;t matter).<\/p>\n<pre>-\/\/depot\/foo...\/*.dll \/\/CLIENT\/foo...\/*.dll<\/pre>\n<p><a href=\"http:\/\/stackoverflow.com\/questions\/55449\/can-you-ignore-a-file-in-perforce\" target=\"_blank\" rel=\"noopener\">Reference<\/a><br \/>\n<a href=\"http:\/\/answers.perforce.com\/articles\/KB_Article\/Exclude-Directories-from-Commands\" target=\"_blank\" rel=\"noopener\">How can I exclude a directory from a Perforce command?<\/a><\/p>\n<p>P4IGNORE<br \/>\nSpecify a file that contains a list of files to ignore when adding files to the depot and reconciling workspaces.<br \/>\n<a href=\"http:\/\/www.perforce.com\/perforce\/doc.current\/manuals\/cmdref\/P4IGNORE.html\" target=\"_blank\" rel=\"noopener\">Reference<\/a><\/p>\n<p><strong>How to check last 10 submitted, pending, or shelved changelists that include any file under the project directory?<\/strong><br \/>\np4 changes -m 5 \/\/depot\/project\/&#8230;<\/p>\n<p><strong>How to check last 10 submitted or pending, or shelved changelists that include any file under the project directory?<\/strong><br \/>\np4 changes -m 1 -s submitted | pending | shelved<\/p>\n<p>Interview Questions Related to Perforce Admin<\/p>\n<ol>\n<li>How to take perforce backup<\/li>\n<li>How to restore perforce backup<\/li>\n<li>How to verify health of the perforce repos database<\/li>\n<li>What is the ise of p4 dbverify and p4 verify<\/li>\n<\/ol>\n<p><strong>What is the use of p4 admin commands.<\/strong><\/p>\n<p>The p4 admin command allows Perforce superusers to perform administrative tasks even when working from a different machine than the one running the shared Perforce service.<br \/>\np4 [g-opts] admin checkpoint [ -z | -Z ] [ prefix ]<br \/>\np4 [g-opts] admin journal [ -z ] [ prefix ]<br \/>\np4 [g-opts] admin stop<br \/>\np4 [g-opts] admin restart<br \/>\np4 [g-opts] admin updatespecdepot [ -a | -s type ]<br \/>\np4 [g-opts] admin resetpassword -a | -u user<br \/>\nReference \u2013 <a href=\"http:\/\/www.perforce.com\/perforce\/doc.current\/manuals\/cmdref\/p4_admin.html\" target=\"_blank\" rel=\"noopener\">Click here<\/a><\/p>\n<p><strong>How to remove files from perforce permanently?<\/strong><br \/>\np4 archive -p with caution. This is the one of only two commands in Perforce that actually removes file data. (The other command that removes file data is p4 obliterate.)<\/p>\n<p><strong>How to set properly in Perforce?<\/strong><br \/>\nThe Perforce service offers three ways of storing metadata: counters\/keys, attributes, and properties.<\/p>\n<p>If your application requires only the flat storage of simple key\/value pairs, and attempts to implement no security model, use the p4 counters and p4 keys commands.<\/p>\n<p>The p4 property command can be used by administrators to view and update property definitions stored in the Perforce service. The service does not use the property definitions; it provides this capability for other Perforce applications, such as P4V<\/p>\n<p>If your application&#8217;s metadata is associated with particular files, use p4 attribute.<\/p>\n<p>If your application&#8217;s metadata is not associated with files, and if you have a requirement to restrict its visibility to users, groups, and\/or to control the precedence of multiple values using sequence numbers, use p4 property.<\/p>\n<p>p4 property -n name -v value<br \/>\np4 counter mycounter 123<br \/>\np4 key mykey 12<br \/>\np4 attribute -n name [ -v value ] files&#8230;<\/p>\n<p><strong>Perforce Integration with other Tools<\/strong><\/p>\n<ol>\n<li>Gitfushion<\/li>\n<li>Swarm<\/li>\n<li>Replication<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Some of the perforce commands which is not commonly used but useful. p4 annotate &#8211; Print file lines along with their revisions. e.g p4 annotate file.c How to ignore files\/folder in perforce workspace\/client? Assuming you have a client named &#8220;CLIENT&#8221;, a directory named &#8220;foo&#8221; (located at your project root), and you wish to ignore all&#8230;<\/p>\n","protected":false},"author":1,"featured_media":3543,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_joinchat":[],"footnotes":""},"categories":[370],"tags":[767,1824,766,507,1553,373,1825,1829,1826,1827,482,1830,341,637,381,1828],"class_list":["post-374","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-perforce","tag-answer","tag-control","tag-interview","tag-list","tag-most-asked","tag-perforce","tag-perforce-interview","tag-perforce-interview-qa","tag-perforce-interview-questions","tag-perforce-interview-questions-answers","tag-questions","tag-selected","tag-tool","tag-top","tag-version","tag-version-control-interview-questions-and-answer"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/374","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=374"}],"version-history":[{"count":2,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/374\/revisions"}],"predecessor-version":[{"id":3545,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/374\/revisions\/3545"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/3543"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=374"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=374"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=374"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}