【问题标题】:Downloading a depot in perforce在 perforce 中下载软件仓库
【发布时间】:2013-06-04 19:01:07
【问题描述】:

我是 perforce 的新用户(来自 svn)并且正在使用 gui 界面 p4v。我想在某人的仓库中拥有一个文件夹的本地副本,但我不确定该怎么做。我希望最终得到一个本地副本,仅供我探索和环顾四周。我不希望它受到修订控制。只需要它就像我从互联网上下载了一个文件夹一样,可以随意使用它。我如何在 p4v 中做到这一点?

【问题讨论】:

    标签: perforce p4v


    【解决方案1】:

    同步文件后,您可以对它们做任何您想做的事情。 Perforce 将文件标记为只读,除非您打开它们进行编辑,所以我要做的是同步软件仓库,将其复制到硬盘上的新位置,然后将所有文件标记为可写。

    另外,如果您只想查看文件,您可以同步软件仓库并打开文件。你甚至可以检查它们(假设你有权限),如果你想修改,就不要提交这些更改。

    【讨论】:

      【解决方案2】:

      这 2 个功能将帮助您开始工作。

      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;
      }
      

      【讨论】:

        猜你喜欢
        • 2020-09-07
        • 1970-01-01
        • 2013-02-12
        • 2014-11-19
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多