Missing delete in graft if file conflicts
Created originally on Bitbucket by delcock (Dave E)
Before we begin, there's a simple workaround which is to do grafts involving conflicts with deleted files from the command line.
Setup simple example (commands at DOS command line):
- mkdir thgbugsimple
- cd thgbugsimple
- hg init
- echo >> file.txt
- hg add file.txt
- hg commit -m"Add file"
- hg branch branch
- hg commit -m"Create branch"
- hg rm file.txt
- hg commit -m"Delete file"
- hg update default
- echo edited >> file.txt
- hg commit -m"Edited file"
Graft from command line works:
- hg graft 2
- <choose "d" to accept remote delete>
Expected and actual behaviour for command line graft:
- Empty folder except for .hg dir
- New commit including graft which deletes file
Try again in TortoiseHG:
- Run "hg strip 4" at command line to strip the graft and return to default tip
- Open TortoiseHG workspace for the folder
- Right click commit 2 in commit graph
- Click "Graft to local"
- On the dialog I have "Use my username...", "Use current date..." and "Append graft info..." ticked
- Click "Graft"
- Click "resolve"
- Double click file.txt conflict
- Click "Delete"
- Click "Continue" - dialog says "Graft is complete"
- Click "Close"
Expected behaviour:
- New grafted commit should appear in commit graph
- Should be at commit 4
- File.txt should be deleted in commit 4 and in the directory
Actual behaviour:
- No new commit in commit graph
- Still at commit "3+"
- File.txt is deleted from the directory
- "hg status" at command line doesn't complain of missing file.txt
- Untracked file "file.txt.orig" is now present
- "hg update 3" and equivalent in TortoiseHG don't restore file.txt
Log output for TortoiseHG graft actions (for graft only):
% hg graft --currentdate --config=ui.merge=internal:fail --currentuser --log 2 grafting 2:6b42d2eabfbb "Delete file" abort: unresolved conflicts, can't continue hint: use 'hg resolve' and 'hg graft --continue --user "Xyz xyz@xyz.com" --date "1530011517 -3600" --log' [command returned code 255 Tue Jun 26 12:11:57 2018] % hg resolve --repository "C:\Projects\thgbugsimple" -- "C:\Projects\thgbugsimple\file.txt" (no more unresolved files) continue: hg graft --continue [command completed successfully Tue Jun 26 12:12:02 2018] % hg graft --currentdate --continue --config=ui.merge=internal:fail --log --currentuser grafting 2:6b42d2eabfbb "Delete file" note: graft of 2:6b42d2eabfbb created no changes to commit [command completed successfully Tue Jun 26 12:12:05 2018]
Another example involving multiple files (commands at DOS command line):
- mkdir thgbugmorefiles
- cd thgbugmorefiles
- hg init
- echo >> file1.txt
- echo >> file2.txt
- hg add file1.txt file2.txt
- hg commit -m"Add files"
- hg branch branch
- hg commit -m"Create branch"
- hg rm file1.txt file2.txt
- hg commit -m"Delete files"
- hg update default
- echo edited >> file1.txt
- hg commit -m"Edited file1"
Similar to the first example, this works fine with a graft from command line.
Following equivalent steps as above for the first example for TortoiseHG:
Expected behaviour:
- New grafted commit should appear in commit graph
- Should be at commit 4
- File1.txt and file2.txt should be deleted in commit 4 and in the directory
- "hg update 3" and equivalent TortoiseHG actions should restore both file1.txt and file2.txt
Actual behaviour:
- We do get commit 4 in the commit graph
- Commit 4 only records the deletion of file2.txt, not file1.txt
- File1.txt and file2.txt are deleted from the directory
- "hg status" at command line doesn't complain of missing file1.txt
- Untracked file "file1.txt.orig" is now present
- "hg update 3" and equivalent in TortoiseHG don't restore file1.txt, only file2.txt
Log output for thgbugmorefiles example (for graft only):
% hg graft --currentdate --config=ui.merge=internal:fail --currentuser --log 2 grafting 2:01828139e56b "Delete files" abort: unresolved conflicts, can't continue hint: use 'hg resolve' and 'hg graft --continue --user "Xyz xyz@xyz.com" --date "1530012565 -3600" --log' [command returned code 255 Tue Jun 26 12:29:26 2018] % hg resolve --repository "C:\Projects\thgbugmorefiles" -- "C:\Projects\thgbugmorefiles\file1.txt" (no more unresolved files) continue: hg graft --continue [command completed successfully Tue Jun 26 12:29:35 2018] % hg graft --currentdate --continue --config=ui.merge=internal:fail --log --currentuser grafting 2:01828139e56b "Delete files" [command completed successfully Tue Jun 26 12:29:41 2018]
I'm on Windows 10, using TortoiseHG 4.6.1. I initially found this in ~3.8(?) and upgraded to see if it would help, but no joy.