英文:
Have incremental local perforce scls similar to git for a single file
问题
考虑我有一个名为developers.txt
的文件。
我想要做的是(而且我可以在git
中很好地完成这个任务)
有3-4个提交,每个提交添加1行。
commit 2ad54bfe954006bafcb209f06ac0c12091d297c8 (HEAD -> main)
Author: Anuraag <anuraag@something.com>
Date: Thu Jun 1 15:04:57 2023 +0530
作者 #3 添加
developers.txt
commit 26cabf7fa07154b19deff41c5cbb07bf0782bde7
Author: Anuraag <anuraag@something.com>
Date: Thu Jun 1 15:04:43 2023 +0530
作者 #2 添加
developers.txt
commit d9e57385b505e2e02a8dc6064466c3974f22e66d
Author: Anuraag <anuraag@something.com>
Date: Thu Jun 1 15:04:23 2023 +0530
作者 #1 添加
developers.txt
commit 03e7f4abddfa26b4b0518994c81e0a724ba1a778
Author: Anuraag <anuraag@something.com>
Date: Thu Jun 1 15:03:56 2023 +0530
添加标题
developers.txt
% cat developers.txt
作者:
1. Arthur
2. Canon
3. Doyle
我想知道的是,在使用Perforce时是否有这样的增量本地工作空间开发方法?
我想要SCL#3
位于SCL#2
,SCL#1
等的顶部,但每个SCL都将用于同一个文件,即developers.txt
。
英文:
Consider i have a file called developers.txt
What i want to do is (and i could do it in git
neatly)
have 3-4 commits, each adding 1 line per commit
commit 2ad54bfe954006bafcb209f06ac0c12091d297c8 (HEAD -> main)
Author: Anuraag <anuraag@something.com>
Date: Thu Jun 1 15:04:57 2023 +0530
author #3 added
developers.txt
commit 26cabf7fa07154b19deff41c5cbb07bf0782bde7
Author: Anuraag <anuraag@something.com>
Date: Thu Jun 1 15:04:43 2023 +0530
author #2 added
developers.txt
commit d9e57385b505e2e02a8dc6064466c3974f22e66d
Author: Anuraag <anuraag@something.com>
Date: Thu Jun 1 15:04:23 2023 +0530
author #1 added
developers.txt
commit 03e7f4abddfa26b4b0518994c81e0a724ba1a778
Author: Anuraag <anuraag@something.com>
Date: Thu Jun 1 15:03:56 2023 +0530
adds heading
developers.txt
% cat developers.txt
Authors:
1. Arthur
2. Canon
3. Doyle
What i want to know is, is there such an incremental local workspace development method when using perforce?
I want to have SCL#3
to be on top of SCL#2
, SCL#1
etc.. but each SCL will be for the same file, in this case developers.txt
答案1
得分: 0
是的,这只是基本版本控制,应该在任何版本控制系统中表现类似。每个版本都是在前一个版本的基础上构建。
C:\Perforce\test>echo Authors:>developers.txt
C:\Perforce\test>p4 add developers.txt
//stream/main/developers.txt#1 - opened for add
C:\Perforce\test>p4 submit -d "adds heading"
Submitting change 460.
Locking 1 files ...
add //stream/main/developers.txt#1
Change 460 submitted.
C:\Perforce\test>p4 edit developers.txt
//stream/main/developers.txt#1 - opened for edit
C:\Perforce\test>echo 1. Arthur>>developers.txt
C:\Perforce\test>p4 submit -d "author #1 added"
Submitting change 461.
Locking 1 files ...
edit //stream/main/developers.txt#2
Change 461 submitted.
C:\Perforce\test>p4 edit developers.txt
//stream/main/developers.txt#2 - opened for edit
C:\Perforce\test>echo 2. Conan>>developers.txt
C:\Perforce\test>p4 submit -d "author #2 added"
Submitting change 462.
Locking 1 files ...
edit //stream/main/developers.txt#3
Change 462 submitted.
C:\Perforce\test>p4 edit developers.txt
//stream/main/developers.txt#3 - opened for edit
C:\Perforce\test>echo 3. Doyle>>developers.txt
C:\Perforce\test>p4 submit -d "author #3 added"
Submitting change 463.
Locking 1 files ...
edit //stream/main/developers.txt#4
Change 463 submitted.
现在我们有了带有4个版本的 developers.txt
。我们可以看到头版本包含了前面的4个更改。
C:\Perforce\test>cat developers.txt
Authors:
1. Arthur
2. Conan
3. Doyle
我们可以看到它的历史记录,以更改列表的形式显示对其进行的更改。
C:\Perforce\test>p4 filelog developers.txt
//stream/main/developers.txt
... #4 change 463 edit on 2023/06/01 by Samwise@Samwise-dvcs-1509687817 (text) 'author #3 added'
... #3 change 462 edit on 2023/06/01 by Samwise@Samwise-dvcs-1509687817 (text) 'author #2 added'
... #2 change 461 edit on 2023/06/01 by Samwise@Samwise-dvcs-1509687817 (text) 'author #1 added'
... #1 change 460 add on 2023/06/01 by Samwise@Samwise-dvcs-1509687817 (text) 'adds heading'
我们可以使用 annotate
命令查看文件的内容及其与历史记录的上下文,即每行内容是在哪个版本/更改列表中添加的。
C:\Perforce\test>p4 annotate developers.txt
//stream/main/developers.txt#4 - edit change 463 (text)
1: Authors:
2: 1. Arthur
3: 2. Conan
4: 3. Doyle
C:\Perforce\test>p4 annotate -c developers.txt
//stream/main/shelves/developers.txt#4 - edit change 463 (text)
460: Authors:
461: 1. Arthur
462: 2. Conan
463: 3. Doyle
英文:
Yes, this is just basic versioning and should behave similarly across any version control system. Every version builds on the one before it.
C:\Perforce\test>echo Authors:>developers.txt
C:\Perforce\test>p4 add developers.txt
//stream/main/developers.txt#1 - opened for add
C:\Perforce\test>p4 submit -d "adds heading"
Submitting change 460.
Locking 1 files ...
add //stream/main/developers.txt#1
Change 460 submitted.
C:\Perforce\test>p4 edit developers.txt
//stream/main/developers.txt#1 - opened for edit
C:\Perforce\test>echo 1. Arthur>>developers.txt
C:\Perforce\test>p4 submit -d "author #1 added"
Submitting change 461.
Locking 1 files ...
edit //stream/main/developers.txt#2
Change 461 submitted.
C:\Perforce\test>p4 edit developers.txt
//stream/main/developers.txt#2 - opened for edit
C:\Perforce\test>echo 2. Conan>>developers.txt
C:\Perforce\test>p4 submit -d "author #2 added"
Submitting change 462.
Locking 1 files ...
edit //stream/main/developers.txt#3
Change 462 submitted.
C:\Perforce\test>p4 edit developers.txt
//stream/main/developers.txt#3 - opened for edit
C:\Perforce\test>echo 3. Doyle>>developers.txt
C:\Perforce\test>p4 submit -d "author #3 added"
Submitting change 463.
Locking 1 files ...
edit //stream/main/developers.txt#4
Change 463 submitted.
Now we have our developers.txt
with 4 versions. We can see that the head revision contains all 4 changes:
C:\Perforce\test>cat developers.txt
Authors:
1. Arthur
2. Conan
3. Doyle
We can see its history as a list of the changes made to it:
C:\Perforce\test>p4 filelog developers.txt
//stream/main/developers.txt
... #4 change 463 edit on 2023/06/01 by Samwise@Samwise-dvcs-1509687817 (text) 'author #3 added'
... #3 change 462 edit on 2023/06/01 by Samwise@Samwise-dvcs-1509687817 (text) 'author #2 added'
... #2 change 461 edit on 2023/06/01 by Samwise@Samwise-dvcs-1509687817 (text) 'author #1 added'
... #1 change 460 add on 2023/06/01 by Samwise@Samwise-dvcs-1509687817 (text) 'adds heading'
And we can annotate
the file to see the content of the file in context of the history, i.e. which revision/changelist added each line of content:
C:\Perforce\test>p4 annotate developers.txt
//stream/main/developers.txt#4 - edit change 463 (text)
1: Authors:
2: 1. Arthur
3: 2. Conan
4: 3. Doyle
C:\Perforce\test>p4 annotate -c developers.txt
//stream/main/shelves/developers.txt#4 - edit change 463 (text)
460: Authors:
461: 1. Arthur
462: 2. Conan
463: 3. Doyle
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论