Perforce 将目录快速同步到干净状态 [英] Perforce fast sync a directory to a clean state

查看:80
本文介绍了Perforce 将目录快速同步到干净状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个不需要强制同步的快速解决方案,它将指定目录置于其原始存储库状态.

  • 可能会从磁盘中删除相同的文件
  • 可以从磁盘添加相同的文件
  • 磁盘上的某些文件可能会被修改
  • 某些文件可能被标记为强制删除、添加或修改

我想要的是确保在运行命令后我将没有这些.

p4 -f sync 不是一个选项,我需要一个更快的解决方案来最大限度地减少网络使用.

以防万一有人问起,perforce 代理不在讨论范围内.

我知道部分解决方案是:

p4 diff -sd -se//clientspec/dir/... |p4 -x - 还原

问题是这不会删除添加到上面路径中的文件,这些文件不在 perforce 中 - 我想从磁盘中删除的文件.

此外,我需要一个多平台或跨平台的解决方案 - 它必须适用于 Windows、OS X 和 Linux.

解决方案

Perforce 在 2014.1 中添加了一个新命令p4 clean",通过将您的工作区重置为其 #have 状态,该命令完全符合您的要求:

  • 不在 Perforce 中的新文件将被删除
  • 在 Perforce 控制之外修改的文件将被重置
  • 在 Perforce 控制之外删除的文件将被恢复

该命令是p4 reconcile -w"的别名,并使用文件的哈希和来确定它们在您的工作区中的状态.

I want a fast solution that does not require force sync that will put a specified directory to its original repository state.

  • same files may be removed from disk
  • same files may be added from disk
  • some files may be modified on disk
  • some files may be marked for removal, addition or modification in perforce

All I want is to be sure that after if run the command I will have none of these.

p4 -f sync is not an option, I need a faster solution that does minimize networks usage.

Just in case someone asks, perforce proxy is out of discussion.

I do know that a partial solution is:

p4 diff -sd -se //clientspec/dir/... | p4 -x - revert

The problem is that this does not remove files added to the paths above that are not in perforce - files that I want to be removed from disk.

Also, I need a multi or cross platform solution - it has to work on Windows, OS X and Linux.

解决方案

Perforce has added a new command "p4 clean" in 2014.1 that does exactly what you are looking for, by resetting your workspace to its #have state:

  • New files not in Perforce will be deleted
  • Files modified outside of Perforce control will be reset
  • Files deleted outside of Perforce control will be restored

The command is an alias for "p4 reconcile -w" and uses the hashsum of the files to determine their state in your workspace.

这篇关于Perforce 将目录快速同步到干净状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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