[p4] diff between two revisions

David Weintraub qazwart at gmail.com
Tue Jan 30 11:26:17 PST 2007


Since the example you gave was from Subversion, I assume you're
familiar with the way Subversion does revisions. In Subversion, doing
a "svn commit" creates a new revision number not just on the file, but
on the whole source archive. So, it isn't uncommon for Subversion
shops to refer to a release by the revision number of the source
archive.

Perforce has a very similar mechanism called changelists. When you do
a "p4 submit", you are creating a changelist number that really
reaches across the whole source depot. Just as in Subversion where you
can refer to a release by its revision number, so to you can refer to
a release in Perforce by its changelist number. For example, I can
refer to a file revision "foo.c at 1239" even though the file "foo.c"
wasn't changed in changelist 1239. It's just like I can refer to
Revision# 1239 of "foo.c" in Subversion even though "foo.c" wasn't
changed when Revision 1239 was committed.

However, at the same time, Perforce, like every other version control
system except Subversion, tracks changes on each individual file. Each
time a file is submitted, the revision for that file is incremented.
That way, you can talk about Revision #9 of file "foo.c" as you can
talk about changelist #1239 of file "foo.c". In fact, these both may
refer to the same revision of file foo.c.

Both Vinny and I assumed you were referring to a changelist when you
talked about revisions 1186 and 1499 because we simply assumed that
these were changelist numbers. Unlike Subversion, revision numbers for
specific files don't usually get that high.

Going through this one more time:

Assume that Revision #9 of Makefile was on Changelist 1186 and
Revision #13 was on Changelist 1499, the following would give you the
same result:

$ p4 diff2 Makefile#9 Makefile#13
$ p4 diff2 Makefile at 1186 Makefile at 1499

You can also mix up changelists and revision numbers in the same command:

$ p4 diff2 Makefile#9 Makefile at 1499

Or use labels:

$ p4 diff2 Makefile at REL-1.2 Makefile at REL-2.0

Or dates:

$ p4 diff2 Makefile at 2007/01/03 Makefile at 2007/01/29


It really doesn't matter since all thesemechanisms are just ways of
refering to a specific revision of a particular file.

On 1/30/07, Jeff Sparks <jeffrsparks at yahoo.com> wrote:
>
> Thanks.  Just so I understand the rationale, what exactly is wrong with the use of '#'?  'p4 help revisions' states
>
>     #rev - A revision number.
>     @change - A change number: the revision as of that change.
>
> Could you explain the meaning of the p4 output shown when I use '#' instead?  It is the sort-of-half-works aspect which threw me; otherwise, I may have tried something different like '@'.
>
>
> "Vinny Murphy (vmurphy)" <vmurphy at cisco.com> wrote: Do "p4 diff2 Makefile at 1499 Makefile@"
>
> -----Original Message-----
> From: perforce-user-bounces at perforce.com
> [mailto:perforce-user-bounces at perforce.com] On Behalf Of Jeff Sparks
> Sent: Tuesday, January 30, 2007 11:31 AM
> To: perforce-user at perforce.com
> Subject: [p4] diff between two revisions
>
> Sorry, I'm sure this is obvious but I haven't found an answer after
> almost an hour of googling.  I just want the diff between two revisions,
> the p4 equivalent of
>
>     svn diff -r1499:1186 Makefile
>
> I've tried things like
>
> terra% p4 changes Makefile
> Change 1499 on 2007/01/16 by jeff at terra 'blah'
> Change 1186 on 2007/01/11 by jeff at terra 'blah blah'
> Change 8 on 2006/11/30 by peter at firma 'initial'
> terra% p4 diff Makefile#1499 Makefile#1186
> Makefile#1499 - file(s) up-to-date.
> Makefile#1186 - file(s) up-to-date.
> terra% p4 diff2 Makefile#1499 Makefile#1186 No file(s) at that revision.
>
> but I'm just flailing away.  I can't believe I can't figure this out.
> What am I missing?
> --Jeff
>
>
> ---------------------------------
> Need Mail bonding?
> Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.
> _______________________________________________
> perforce-user mailing list  -  perforce-user at perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user
>
>
>
> ---------------------------------
> Now that's room service! Choose from over 150,000 hotels
> in 45,000 destinations on Yahoo! Travel to find your fit.
> _______________________________________________
> perforce-user mailing list  -  perforce-user at perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user
>


-- 
--
David Weintraub
qazwart at gmail.com


More information about the perforce-user mailing list