Difference between revisions of "Perforce obsolete"

From ITSwiki
Jump to: navigation, search
[unchecked revision][unchecked revision]
(Further reading)
Line 161: Line 161:
 
[http://www.perforce.com/perforce/doc.current/manuals/p4guide/ Guide to the visual client]
 
[http://www.perforce.com/perforce/doc.current/manuals/p4guide/ Guide to the visual client]
  
 +
[http://www.perforce.com/perforce/doc.current/manuals/p4guide/chapter.configuration.html#DB5-54093 Understanding the client configuration]
  
 +
[http://www.perforce.com/perforce/doc.current/manuals/cmdref/views.html Understanding views]
  
  
 
[[Category:IT]]
 
[[Category:IT]]

Revision as of 01:19, 29 November 2015

Gentle introduction to Perforce

If you are unfamiliar with Perforce and especially with source control systems, there is a gentle introduction on the perforce website.

Installing

Download clients

Both visual and command-line clients can be downloaded for Mac, Linux, and Windows on the perforce website:

http://www.perforce.com/downloads/helix#clients

Direct links to the most common clients are found below. The links point to R15.2 of the command line clients, and R15.1 of the visual clients. Links are last updated 2015.11.28

Linux Clients

32 bit command line

64 bit command line

32 bit visual clients

64 bit visual clients

Mac Clients

32 bit command line

64 bit command line

visual clients for OS X 10.8+

Windows Clients

32 bit command line

64 bit command line


32 bit visual clients

62 bit visual clients

Basic configuration

The basic setup procedure is different for the gui and for the command line. Common for both of them is the server address and establishment of trust.

The perforce server has the address

ssl:perforce.compute.dtu.dk:1666

Authentication happens using the portalen username and password. Access to this server is administrated by Henning Christensen who can be reached at the email address at hench at dtu.dk.

Upon initial connection you are asked to approve the fingerprint of the perforce server. The fingerprint should be

#F6:7A:7A:9C:15:33:CE:16:DB:EA:6E:A9:24:05:FB:E8:63:B7:0D:2A

If another fingerprint is displayed, you are connecting to the wrong server - contact IT support.

Using the graphical interface

The graphical interface is called P4V. At first connection, you are asked to trust the server. If the fingerprint corresponds to the fingerprint above check the trust button.

As workspace, the workspace called <username>_default should be used.

Using the command line

The command line is configured using environmental variables. These variables are set using the perforce command line. Set the following options

# p4 set P4PORT=ssl:perforce.compute.dtu.dk:1666
# p4 set P4USER=<username>
# p4 set P4CLIENT=<username>_default
# p4 set P4CONFIG=.p4config

The current loaded settings can always be seen by typing p4 set in command line. Verify your installation by typing

# p4 set
P4CLIENT=tsal_pc (enviro)
P4CONFIG=.p4config (enviro) (config '/home/tsal/.p4config' )
P4EDITOR=vi (enviro)
P4IGNORE=.p4ignore (config '/home/tsal/.p4config')
P4PORT=ssl:perforce.compute.dtu.dk:1666 (enviro)
P4USER=tsal (config '/home/tsal/.p4config')

On linux/mac, these settings are stored in the file ~/.p4enviro. On Windows the settings are stored in the registry. The command line has many configurables, to see most of them, type

# p4 help environment

The documentation for perforce is built into the program. You can get help by typing

# p4 help 
# p4 help <command>

Setting up a tunnel to connect outside DTU

At this moment, the perforce server is only reachable from DTU networks - but this is subject to change soon. The easiest way to get around this is to use the OpenVPN provided by DTU compute. Alternatively you can setup a ssh tunnel. On Windows/Linux/Mac, use the following command

# ssh -L 1666:perforce.compute.dtu.dk:1666 <user>@thinlinc.compute.dtu.dk

Alternatively, use autossh with ssh keys - this will automatically restablish lost connections - e.g. on sleep/resume when using a laptop the connection is automatically established.

# autossh -i .ssh/ -L 1666:perforce.compute.dtu.dk:1666 <user>@thinlinc.compute.dtu.dk

On windows, the the two best options are putty and bitvise ssh. Bitvise supports automatic reconnections which is very useful for laptop users. This program can be downloaded here:

http://www.bitvise.com/ssh-client-download

Get the template file and insert your username and password. The bitvise client can be setup to start automatically, by inserting the following link in the startup folder

"C:\Program Files (x86)\Bitvise SSH Client\BvSsh.exe" -loginOnStartup -profile="<path to bscp file>"

If you opt for using a tunnel, you have to use ssl:localhost:1666 as P4PORT instead.

Excluding files from perforce

Archive structure

The perforce server can be accessed publicly using

https://archive.compute.dtu.dk

The general layout is as follows

//comp/ # MAIN depot with non-terabyte content

//comp/courses/ # courses
//comp/courses/02450/

//comp/common/ # common folder accessible for compute staff
//comp/common/MATLAB/extern/sgetools/ # our customizations to SGE tools
//comp/common/MATLAB/extern/sgetools/codeline.txt # information about codeline

//comp/extern/ # external libs
//comp/extern/MATLAB/gpml-matlab/MAIN # 
//comp/extern/MATLAB/sgetools/MAIN # 

//comp/sections/
//comp/sections/cogsys/projects/

//comp/projects/
//comp/projects/cosound/

//comp/users/
//comp/users/tsal/


//comp-archive/ # ARCHIVE depot - contains all publications in their entirety

//comp-data/ # DATA depot - 

Common use cases

Frequently Asked Questions

The client shows I don't have a file even though I do, how do I handle it?

This scenario can happen if you by other means move files/folders that are under Perforce source control. Perforce has a "have" database that contains which files are retrieved in which revision on each workspace, p4 have will show you the current "have list" for the chosen workspace. The p4 have list can be out of sync:

  1. You create a new workspace that points to files under perforce source control
  2. You move files by other means (e.g copy files to grid, or sync files using dropbox) to other machines and use different workspaces.
  3. Manually delete files

To resolve, run

# p4 sync -k

Further reading

Perforce cheat sheet.

Perforce command line reference

Guide to the visual client

Understanding the client configuration

Understanding views