( )⚙ D7521 amend: check for file modifications when updating dirstate (issue6233)

This is an archive of the discontinued Mercurial Phabricator instance.

amend: check for file modifications when updating dirstate (issue6233)
ClosedPublic

Authored by spectral on Nov 26 2019, 7:29 PM.

Details

Summary

Previously, we called dirstate.normal(f), which would put information into the
dirstate claiming that the file on disk is what it "should be" for the current
checkout, and it would have the size and timestamp of the most recent
modification to the file (which is not necessarily the one we just committed).
If the file was modified while the commit message editor was open, we would put
incorrect information into the dirstate.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

spectral created this revision.Nov 26 2019, 7:29 PM
mharbison72 requested changes to this revision.Dec 2 2019, 9:47 AM
mharbison72 added a subscriber: mharbison72.
mharbison72 added inline comments.
tests/test-amend.t
493

This whole test needs to be wrapped in #if exebit to keep Windows happy.

This revision now requires changes to proceed.Dec 2 2019, 9:47 AM
spectral updated this revision to Diff 18425.Dec 2 2019, 1:40 PM
spectral marked an inline comment as done.Dec 2 2019, 1:43 PM
spectral added inline comments.
tests/test-amend.t
493

Replaced this with what other tests do: call sh directly (example: test-rebase-collapse.t, L37).

496

Also had to actually amend to include this fix, I'd left it in my working directory. Oops.

mharbison72 accepted this revision.Dec 2 2019, 6:51 PM

Windows is happy with this test

pulkit accepted this revision.Dec 6 2019, 9:00 AM
This revision is now accepted and ready to land.Dec 6 2019, 9:00 AM
pulkit added a comment.Dec 6 2019, 9:55 AM

I get the following test failure:

--- /home/pulkit/repo/hgpush/tests/test-amend.t                                          
+++ /home/pulkit/repo/hgpush/tests/test-amend.t#obsstore-off.err              
@@ -505,4 +505,23 @@                                                                                                                                           
   >   hg diff                                                                                                                                                 
   >   hg status                                                                                                                                               
   > fi                                                                                                                                                      
-  OK.                                                                              
+  $TESTTMP.sh: 292: $TESTTMP.sh: [[: not found                                                              
+  Bug detected. 'delta' is not part of the commit OR the wdir                                                       
+  Diff and status before rebuild:                                                 
+  diff --git a/foo b/foo                                                       
+  --- a/foo                                                                       
+  +++ b/foo                                                                   
+  @@ -1,2 +1,3 @@                                                                                              
+   alpha                                                                          
+   beta                                                                          
+  +delta                                                                             
+  M foo                                                                           
+  Diff and status after rebuild:                                                  
+  diff --git a/foo b/foo                                                                
+  --- a/foo                                                                             
+  +++ b/foo                                                                                                                                                   
+  @@ -1,2 +1,3 @@                                                                                                                                             
+   alpha                                                                                                                                                      
+   beta                                                                                                                                                     
+  +delta                                                                                                                                                      
+  M foo         
                                                                                                                     
ERROR: test-amend.t#obsstore-off output changed                                    
!.                                                                              
--- /home/pulkit/repo/hgpush/tests/test-amend.t                                    
+++ /home/pulkit/repo/hgpush/tests/test-amend.t#obsstore-on.err                
@@ -505,4 +505,23 @@                                                                                            
   >   hg diff                                                                     
   >   hg status                                                                  
   > fi                                                                               
-  OK.                                                                             
+  $TESTTMP.sh: 317: $TESTTMP.sh: [[: not found                                    
+  Bug detected. 'delta' is not part of the commit OR the wdir                           
+  Diff and status before rebuild:                                                       
+  diff --git a/foo b/foo                                                                                                                                      
+  --- a/foo                                                                                                                                                   
+  +++ b/foo                                                                                                                                                   
+  @@ -1,2 +1,3 @@                                                                                                                                           
+   alpha                                                                                                                                                     
+   beta                                                                                                     
+  +delta
+  M foo
+  Diff and status after rebuild:
+  diff --git a/foo b/foo
+  --- a/foo
+  +++ b/foo
+  @@ -1,2 +1,3 @@
+   alpha
+   beta
+  +delta
+  M foo
spectral marked an inline comment as done.Dec 6 2019, 10:37 AM
This revision was automatically updated to reflect the committed changes.
pulkit added a comment.Dec 6 2019, 1:05 PM

Looks like I forgot to drop this from my queue and pushed it. :(