Pregunta

I am a new user of perforce (coming from svn) and am using the gui interface p4v. I want to have a local copy of a folder in someone's depot but am unsure how to do so. I wish to end up with a local copy that is just for me to explore and look around. I do not wish for it be under revision control. Just need it to be as if i downloaded a folder from the internet, free to do whatever with it. How can i accomplish this in p4v?

¿Fue útil?

Solución

Once you've synced the files, you can do whatever you want with them. Perforce marks files as read only unless you have them open for edit, so what I would do is sync the depot, copy it to a new location on your HDD, and then mark all the files writable.

Also, if all you want to do is look at the files, you could just sync the depot and open the files. You could even check them out (assuming you have permissions) and just not submit those changes if you wanted to tinker.

Otros consejos

This 2 functions will help you start working.

public Repository GetRepository(string i_Workspace, string i_Username, string i_Password, string i_Server)
{
    Repository rep;
    Server server;
    ServerAddress address;

    // Create the repository
    address = new ServerAddress(i_Server + ":1666");
    server = new Server(address);
    rep = new Repository(server);

    rep.Connection.UserName = i_Username;
    Perforce.P4.Options options = new Perforce.P4.Options();
    options["Password"] = i_Password;

    Environment.SetEnvironmentVariable("P4PASSWD", i_Password);

    rep.Connection.Client = new Client();

    if (i_Workspace != null && i_Workspace != string.Empty)
    {
        rep.Connection.Client.Name = i_Workspace;
    }

    rep.Connection.Connect(options);
    rep.Connection.CommandTimeout = System.TimeSpan.Zero;
    rep.Connection.Login(i_Password);


    return rep;
}

private Client createWorkspace(string i_DepotPath, string i_RootDirectory)
{
    string workspaceName = "workspace" + new Random().Next().ToString();

    Repository rep = GetRepository(string.Empty);

    Client client = new Client();
    client.Name = workspaceName;
    client.Root = i_RootDirectory;
    client.OwnerName = k_DefaultUser;
    client.ViewMap = new ViewMap();
    client.Options = ClientOption.AllWrite;
    client.LineEnd = LineEnd.Local;
    client.SubmitOptions = new ClientSubmitOptions(false, SubmitType.SubmitUnchanged);

    string depotPath = i_DepotPath + "/...";

    String clientPath;
    //clientPath = String.Format("//{0}/{1}/...", client.Name, i_DepotPath.Replace("//depot/", string.Empty));
    clientPath = "//" + client.Name + "/...";

    MapEntry entry = new MapEntry(MapType.Include, new DepotPath(depotPath), new ClientPath(clientPath));

    client.ViewMap.Add(entry);


    rep.CreateClient(client);


    return client;
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top