[p4] perforce vs. subversion
Robert Cowham
robert at vaccaperna.co.uk
Wed May 3 14:52:32 PDT 2006
> In general, I find perforce extremely weak in reporting the
> state of the working copy. Its attitude is basically "we know
> what your repository looks like because you told us about
> everything you were going to do".
> This is quite optimistic. svn takes the approach of "use
> your tools to modify your files, and we'll check the files
> status". p4 is theoretically faster, but it is often wrong,
> and forces you to do everything twice. First you call "p4
> edit", then you edit the file. With svn, you just edit the file. Etc.
>
> I regularly run the following commands (wrapped into a p4stat
> script with a nice output format) to determine the state of
> my working copy:
> 'diff -se', 'Unopened and Changed'
> 'diff -sd', 'Unopened and Deleted'
> 'resolve -n', 'Unresolved'
> 'sync -n', 'Unsynchronized'
> 'diff -sa', 'Open and Changed'
> 'diff -sr', 'Opened and Unchanged'
> 'opened', 'Added'
>
> As well, a number of our developers have written ad-hoc
> scripts to try and find new files while accounting for build
> artifacts that should be ignored.
>
> This is so painful I suspect there is something about my
> workhabits that just hasn't adjusted to p4 from cvs/svn.
While I think that this isn't perforce's strong point I don't think it
should be that painful.
Scripts along the lines of:
P4unknown.rb at
http://public.perforce.com/guest/robert_cowham/perforce/utils/p4gui/index.ht
ml
Will help with stuff. I have other wrappers around the other stuff which
took me a good half hour to write...
There are many other scripts/one liners if you search the archives of this
list.
> This seems to be a work-around for one of the things that
> most troubles me, could you describe your workflow for doing
> this? I.e., to open a file with a changelist, it appears I need to do:
>
> % p4 changelists -s pending -u sroberts
> Change 39474 on 2006/05/03 by sroberts at sroberts *pending*
> 'Changes not to be submitted. '
>
> then use the numerical changelist number when I edit the file:
>
> % p4 edit -c 39474 rules.mk
>
> Is this really the process? If so its another thing I would
> add to my p4 wrapper scripts, an "open but not to submit" command.
Why not just open stuff in the default changelist?
The pending changelist stuff works great in GUIs where drag and drop is the
order of the day. From command line it's painful due to having to
remember/find out changelist number. That said, the power of regexes from
command line occasionally wins over Gui conveniences.
> I used to change these conf files and not open them, but "p4
> diff" won't report differences on unopened files! Unless you
> use "p4 diff -f", but a side effect of that is it doesn't
> diff against the base, it diffs against the head in the
> repository, which can make it look like you have removed
> lines when actually there is a new version in the repository.
> Maddening.
P4 diff -f some_file.ext#have
Might be what you want...
> Also, the "p4 submit" commmand (unlike svn) doesn't allow
> multiple arguments. So if you have changes in src/ and doc/,
> but don't want to submit changes in conf/, you have to do a
> "p4 submit ...", then manually weed out the conf/ files. With
> svn, I would do "svn submit src doc".
I've never been sure why submit from command line only takes one argument.
>From GUIs shift click and Ctrl+S does what you want. From command line needs
wrapping unfortunately.
> svn also has simple commands for copy and rename. rename is a
> multi-step command with p4.
Wrapped in guis - easily wrappable in command line.
> > Both systems have their pros and cons. In P4, if you
> "dirtied" a file
> > (ie: you modified it without telling the server), then it won't be
> > submitted until you tell the server about it's change. (There are
> > tools in the P4 toolset that help you find dirty files.)
>
> What tool do you refer to?
>
> All I've found is p4 diff, and I have to call it at least
> twice, once with -sd, once with -se (it silently ignores all
> but the first "-s"
> switch).
I either take the hit from command line or put a very simple script around
it.
If I was doing it reguarly I'd have a script...
> My overall impression of p4 as a user of only 6 months is
> that it may be more powerful, at least I am continually
> assured it does things svn does not do (and that I don't want
> to do), but the simple things I want to do as a developer are
> harder with p4 and easier with svn. p4 seems to want me to
> use its powerful but more complex mechanisms even when I want
> to do simple things.
I would agree that there are times where the Perforce "purist" approach of
"you can wrap it so do it yourself" vs. "we will wrap it for you" is
annoying. However, it does tend to do the wrapping from GUIs, so I can live
with stuff on the command line needing to be wrapped.
Robert
More information about the perforce-user
mailing list