Skip to content

Commit 0108f47

Browse files
simonwilliamsgitster
authored andcommitted
git-p4: allow unshelving of branched files
When unshelving a changelist, git-p4 tries to work out the appropriate parent commit in a given branch (default: HEAD). To do this, it looks at the state of any pre-existing files in the target Perforce branch, omitting files added in the shelved changelist. Currently, only files added (or move targets) are classed as new. However, files integrated from other branches (i.e. a 'branch' action) also need to be considered as added, for this purpose. Signed-off-by: Simon Williams <[email protected]> Acked-by: Luke Diamand <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent aeb582a commit 0108f47

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

git-p4.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1309,7 +1309,7 @@ def processContent(self, git_mode, relPath, contents):
13091309

13101310
class Command:
13111311
delete_actions = ( "delete", "move/delete", "purge" )
1312-
add_actions = ( "add", "move/add" )
1312+
add_actions = ( "add", "branch", "move/add" )
13131313

13141314
def __init__(self):
13151315
self.usage = "usage: %prog [options]"

t/t9832-unshelve.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ test_expect_success 'init depot' '
2222
: >file_to_move &&
2323
p4 add file_to_delete &&
2424
p4 add file_to_move &&
25-
p4 submit -d "add files to delete"
25+
p4 submit -d "add files to delete" &&
26+
echo file_to_integrate >file_to_integrate &&
27+
p4 add file_to_integrate &&
28+
p4 submit -d "add file to integrate"
2629
)
2730
'
2831

@@ -40,6 +43,7 @@ test_expect_success 'create shelved changelist' '
4043
p4 delete file_to_delete &&
4144
p4 edit file_to_move &&
4245
p4 move file_to_move moved_file &&
46+
p4 integrate file_to_integrate integrated_file &&
4347
p4 opened &&
4448
p4 shelve -i <<EOF
4549
Change: new
@@ -53,6 +57,7 @@ Files:
5357
//depot/file_to_delete
5458
//depot/file_to_move
5559
//depot/moved_file
60+
//depot/integrated_file
5661
EOF
5762
5863
) &&
@@ -65,6 +70,7 @@ EOF
6570
test_path_is_file file2 &&
6671
test_cmp file1 "$cli"/file1 &&
6772
test_cmp file2 "$cli"/file2 &&
73+
test_cmp file_to_integrate "$cli"/integrated_file &&
6874
test_path_is_missing file_to_delete &&
6975
test_path_is_missing file_to_move &&
7076
test_path_is_file moved_file

0 commit comments

Comments
 (0)