summaryrefslogblamecommitdiffstats
path: root/test/revert.test
blob: d86dcd6cdf9c8abceb5ccc3a71faa2fa53b8ca22 (plain) (tree)
1
2
3
4
5
6
7
8
9
                       
 


                         
                          
                                        
 
                                     


                                              
 
                         
                            
                                                       






                                                              
                       
                                    
 
                                      
                


                            
                                                        
                                 
                                                        

                       
 



                                      
                                                        

                       
                                                         
 


                                      

                                                        

                       

                                                    
	$ mkdir patches

	$ mkdir sub
	$ echo f1 > sub/f
	$ echo g1 > sub/g
	$ quilt new p.diff
	> Patch %{P}p.diff is now on top

	$ quilt add sub/f sub/g sub/h
	> File sub/f added to patch %{P}p.diff
	> File sub/g added to patch %{P}p.diff
	> File sub/h added to patch %{P}p.diff

	$ echo h1 > sub/h
	$ quilt revert sub/h
	> Changes to sub/h in patch %{P}p.diff reverted

	$ quilt diff -z

# Our patch modifies file f, deletes file g and creates file h
	$ echo f2 > sub/f
	$ rm -f sub/g
	$ echo h2 > sub/h
	$ quilt refresh
	> Refreshed patch %{P}p.diff

# Check if we can revert modifications
	$ cd sub
	$ echo f3 > f
	$ echo h3 > h
	$ quilt revert f g h
	> Changes to sub/f in patch %{_P}p.diff reverted
	> File sub/g is unchanged
	> Changes to sub/h in patch %{_P}p.diff reverted

	$ quilt diff -z

# Check if we can revert file creation
	$ echo g3 > g
	$ quilt revert f g
	> File sub/f is unchanged
	> Changes to sub/g in patch %{_P}p.diff reverted

	$ quilt diff -z
	$ [ ! -e g ] || echo "File sub/g shouldn't exist"

# Check if we can revert file deletion
	$ rm f h
	$ quilt revert f h
	> Changes to sub/f in patch %{_P}p.diff reverted
	> Changes to sub/h in patch %{_P}p.diff reverted

	$ quilt diff -z
	$ [ -e f ] || echo "File sub/f should exist"
	$ [ -e h ] || echo "File sub/h should exist"