Perforce - 从命令行切换到工作区 [英] Perforce - switch to workspace from command line

查看:241
本文介绍了Perforce - 从命令行切换到工作区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在问如何从 client1 切换到 client2,其中 client1 属于 stream1,client2 属于 stream2.

I am asking how to switch from client1 to client2 where client1 belongs to stream1 and client2 belongs to stream2.

我正在寻找它与在 p4v 中执行相同的操作,然后右键单击工作区并选择切换到工作区"

What I am looking for it to do the same as being in p4v and then right click on a workspace and selecting 'switch to workspace'

请注意,如果您当前的工作区是 client1 并且您使用:

Note, that if your current workspace is client1 and you use:

p4 client -s -S //DEPOT/stream2

p4 client -s S //DEPOT/stream2 client2

它不会改变 p4v GUI 中的工作区.

it won't change the workspace in the p4v GUI.

有什么想法吗?

谢谢!

推荐答案

这里有几个不同的概念.

There are several different concepts here.

您可以拥有一个工作区,也可以拥有多个工作区.

You can have a single workspace, or you can have multiple workspaces.

每个工作区在您的工作站上都​​有自己的根目录,以及您最近同步的任何文件的副本.

Each workspace has its own root directory on your workstation, and its own copy of whatever files you have most recently sync'd.

如果您只有一个工作区,则可以通过使用client -s"命令切换该工作区绑定到的流来将该工作区从一个流来回切换到另一个流.这样,您可以使用单个工作区在处理一个流和处理另一个流之间交替.在 Perforce 服务器的最新版本 (2015.1+) 中,甚至还有一个p4 switch"命令,使这个过程更加简单.

If you have a single workspace, you can switch that workspace back and forth from one stream to another, by using the 'client -s' command to switch the stream to which that workspace is bound. This way, you can alternate between working on one stream, and working on another, using a single workspace. In the most recent versions of the Perforce server (2015.1+), there is even a 'p4 switch' command which makes this process simpler still.

在命令行上使用client -s"将您的单个工作区从一个流切换到另一个流,相当于将您的工作区图标从旧流拖放到流图中的新流,或多或少.

Switching your single workspace from one stream to another on the command line using 'client -s' is the equivalent of dragging and dropping your workspace icon from the old stream to the new stream in the Stream Graph, more or less.

您还可以拥有多个工作区,每个工作区都有一组独立的同步文件,并且您可以分别处理每个工作区.在命令行上,要从一个工作区切换到另一个工作区,您只需更改告诉p4"命令要使用哪个客户端的方式,您可以使用 P4CLIENT 变量或-c"标志来执行此操作客户.例如:

You can also have multiple workspaces, each with an independent set of files sync'd, and you can work with each workspace separately. On the command line, to switch from one workspace to another, you simply change the way that you tell the 'p4' command which client you want to use, which you can do with the P4CLIENT variable or the '-c' flag to the client. For example:

p4 -c client1 sync

对比

p4 -c client2 sync

告诉p4客户端先同步client1,然后client2.或者,您可以执行以下操作:

tells the p4 client to sync first client1, then client2. Alternately, you can do:

p4 set P4CLIENT=client1
p4 sync

然后

p4 set P4CLIENT=client2
p4 sync

实现相同的效果(在命令行中在一个工作区和另一个工作区之间切换).

to accomplish the same effect (switching between one workspace and the other at the command line).

然而,P4V 有自己的当前工作空间"概念,它与命令行是分开的,我不相信仅仅改变你的 P4CLIENT 变量就足以执行右键单击"的 P4V 操作工作区并选择切换到工作区".

P4V, however, has its own notion of the "current workspace", which is separate from the command line, and I don't believe that just changing your P4CLIENT variable is enough to perform the P4V operation of "right click on a workspace and selecting 'switch to workspace'".

我认为,最接近命令行命令的方法是从命令行调用 P4V 的不同副本,并在以下情况下指定不同的客户端名称,该命令会更改 P4V 认为是当前工作区的工作区您这样做,如下所述:http://www.perforce.com/博客/100114/p4v-secrets-calling-p4v-command-line

The closest thing you can get to a command-line command which changes which workspace P4V considers to be the current workspace, I think, is to invoke a different copy of P4V from the command line, and specify a different client name when you do so, as described here: http://www.perforce.com/blog/100114/p4v-secrets-calling-p4v-command-line

但我认为这将为您提供一个带有其他工作区的 P4V 窗口,而不是更改您当前 P4V 窗口的当前工作区.

But I think this will get you a new P4V window with the other workspace, rather than changing the current workspace of your current P4V window.

您可以尝试的另一种可能性是使用 Windows GUI 自动化工具之一,例如 Autoit (https://www.autoitscript.com/site/),创建一个脚本,该脚本将使用菜单栏上的连接"菜单并通过 Autoit 操作切换到工作区..."对话框.

Another possibility you could try would be to use one of the Windows GUI automation tools, such as Autoit (https://www.autoitscript.com/site/), to create a script which will use the Connection menu on the menu bar and operate the Switch to Workspace... dialog via Autoit.

这篇关于Perforce - 从命令行切换到工作区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆