Suppose that you only have readonly access to a certain p4 depot, and you cannot check out the files but you are assigned to work on a fix, your manager ask you to give him a patch so that he could apply the patch (suppose that he has the right to check out/modify files)
The reference docs that you might read includes
Also, please see the following link for how the file specification. http://www.perforce.com/perforce/doc.current/manuals/cmdref/o.fspecs.html
the command to run
p4 diff -dub -f //ied/ied/launcher/4.2.0/src/assemblies/IED.Launcher/...#head > C:\MSDE\boqwang\ied\launcher\diff\diff1.txt
and from the output , you may see the following.
==== //ied/ied/launcher/4.2.0/src/assemblies/IED.Launcher/Model/Root.cs#1 - c:\msde\boqwang\ied\launcher\4.2.0\src\assemblies\IED.Launcher\Model\Root.cs ====
@@ -26,7 +26,9 @@
{
#region Private Member Variables
- private static Hashtable m_applications = CollectionsUtil.CreateCaseInsensitiveHashtable();
+ //private static Hashtable m_applications = CollectionsUtil.CreateCaseInsensitiveHashtable();
+ private Hashtable m_applications = CollectionsUtil.CreateCaseInsensitiveHashtable();
+
private readonly object m_syncRoot = new object();
#endregion
@@ -75,15 +77,29 @@
}
}
- public static Application GetApplicationByKey(string key_)
+ //public static Application GetApplicationByKey(string key_)
+ //{
+ // lock(m_applications.SyncRoot)
+ // {
+ // if(m_applications.ContainsKey(key_))
+ // {
+ // return m_applications[key_] as Application;
+ // }
+ // }
+ // return null;
+ //}
+
+ public Application GetApplicationByKey(string key_)
{
- lock(m_applications.SyncRoot)
+ lock (SyncRoot)
{
- if(m_applications.ContainsKey(key_))
+
+ if (m_applications.ContainsKey(key_))
{
return m_applications[key_] as Application;
}
}
+
return null;
}
#endregion
If you want to compare two depot file revisions, then you should use the p4 diff2.
here is one command that diff the content of the head revision with the a revision with a date.
p4 diff2 -db //ied/ied/launcher/4.2.0/src/assemblies/IED.Launcher/...#head //ied/ied/launcher/4.2.0/src/assemblies/IED.Launcher/...@2012/05/10
I will omit the output, you can do the diff yourself and see the output for yourself.
The key difference that I want to highlight here is that with "p4 diff " you can compare the depot with the client file, while with P4 diff2, you can only diff the content of two revision from the depot.