views:

394

answers:

3

I have a project coded in python and I use svn for source-control. But now, I have a part of this code I need to commit with Perforce. As the source tree is quite large with lots of files, I don't want to duplicate the files on the different computers. So I want to keep working on SVN and sometimes, push the code on Perforce.

But I have some problems to do that:

  • when a file is moved or deleted in SVN, submitting the code in Perforce results with an error saying the file is missing and can't be committed. So nothing is committed.

    • Is it possible, when doing a checkout or submit, to tell Perforce to delete files from server if missing on local computer?
  • I don't want all my code on Perforce, so I marked only some directories to be added. No problem there. But to retrieve modifications and new files, the thing is to do a Perforce "checkout". And if I do that on the root directory of my development tree, it marks for add all the files in my development tree. So I ended doing a checkout on every directory I previously added, which is quite annoying and time consuming.

    • Is there a way to tell Perforce to care only about some directories? (I know it is possible to tell it not to care about some patterns. But I have lots of directories not to care and only a few to care so the other way would be better here.)

If anyone has advice, he/she would become my hero ;-). Thanks!

+2  A: 

My advice is not to mix workspaces of two different version control tools. That's like playing around with a loaded shotgun pointing at your feet. It will go off, one day.

It's been some years since I last time used Perforce, but I remember it certainly didn't like anyone else messing with its workspaces. Svn doesn't like it either.

Instead, keep the workspaces separate. Disk space is cheap. It's hard to imagine a code base so large that it wouldn't be feasible. Ideally, version stuff in one repository only. If you still need to version files in two places, set up a merge tool to sync changes between the workspaces. In Windows/Linux environment, Beyond Compare is an excellent tool for manual merging. For automatic merges, some scripting may be required to pull patches from one repository and apply them to the other.

laalto
Thanks for your answer. I know it's strongly advised not to mix version control tools, but there really are lots of files. Not only code but assets used and generated by our software.And as I explain in my comment to Douglas below, using SVN and Perforce is unavoidable.But I'll try the merging solution you're talking about. Knowing that now, only the deleted files problem stays (I set Perforce workspace configuration for the 1st problem). So if it does the trick, it will be solved.
A: 

It sounds like you have the entire server in your client spec, and are checking things out, perhaps using P4V. Don't do that. Alter your client spec with just the directories you want, in the locations you want. Then use p4 sync to keep them updated with changes other people make.

Your description of the problem is rather woolly. Why do you want some of the files under perforce? Are the files in perforce also in svn?

EDIT:

I suspect that http://kb.perforce.com/UserTasks/WorkingDisconnected may be some use for synchronising changes from svn to perforce.

Setup your perforce workspace/client-spec to map the shared locations to their subversion check out locations.

EDIT2:

From your comment, perhaps what you need is a commit hook on your subversion server, that commits changes to certain files onto the perforce server?

In which case, the subversion server could have a perforce client, and do the proper p4 edit/add/delete calls before submitting the change?

Douglas Leeder
Indeed I'm using P4V with checkout like you say. I'll try your solution.And to describe a little more: I am on a team which develops some software and uses SVN as source-control. This won't change I think.And now we have a client with who we share part of our code. We have a VPN with this client and he wants us to use Perforce to push our code in their codebase. This is another thing that can't be changed.So yes, lots of files are on SVN and Perforce. We work on our software and commit the code on the client database (let's say once or twice a week).
Thanks for all your answers people. I can't add hooks to svn because I don't have the rights for that but indeed this would work I think (too sad).For now, someone gave me a solution that works. In P4V, I select a directory, right-click and "Diff against". I diff between the last revision and the local Workspace. Like that I can see which files have been deleted or added locally and mark them for add/delete manually. Then a little checkout mark the modified ones. Finally I submit and it works. It isn't automatic but this will do it for now.
A: 

La solution qui marche pour perforce et de: a chaque version que vous voulez repousser sous perforce: * Faire un "open for Delete" de tous les fichiers du répertoire sous perforce puis un "submit". * Faire un open for add de tous les fichiers puis un submit. Cela fonctionne (pas de perte de fichiers du au renomage,ect..) mais a un gros inconvénient : on perd l'historique....

...A+Benjamin

C'est la solution que je mettais en pratique au début en effet. La perte de l'historique me dérange en effet. Et surtout, devoir renvoyer toute la base de code à chaque fois. On m'a conseillé la solution que je décris dans mon 2ème commentaire à Douglas ci-dessous.
While the answer is appreciated, please can we limit ourselves to the forum's active language.
Marc Gravell