tests/test-diff-copy-depth.t
author Mads Kiilerich <madski@unity3d.com>
Fri, 28 Nov 2014 03:09:06 +0100
changeset 23442 a5c94ea3b8af
parent 12150 bca69641de61
permissions -rw-r--r--
mq: smarter handling of plain headers 6333412245ec and 5ccced6eab0b fixed issue4453 with a simple insertplainheader function that fixed the regression but didn't make the implementation more stable. Now we introduce plain header handling similar to how we handle hg patches. The whole header is scanned for fields to update while determining the best position for inserting the field if it is missing. It also makes sure there is an empty line between headers and body.

  $ for i in aaa zzz; do
  >     hg init t
  >     cd t
  > 
  >     echo
  >     echo "-- With $i"
  > 
  >     touch file
  >     hg add file
  >     hg ci -m "Add"
  > 
  >     hg cp file $i
  >     hg ci -m "a -> $i"
  > 
  >     hg cp $i other-file
  >     echo "different" >> $i
  >     hg ci -m "$i -> other-file"
  > 
  >     hg cp other-file somename
  > 
  >     echo "Status":
  >     hg st -C
  >     echo
  >     echo "Diff:"
  >     hg diff -g
  > 
  >     cd ..
  >     rm -rf t
  > done
  
  -- With aaa
  Status:
  A somename
    other-file
  
  Diff:
  diff --git a/other-file b/somename
  copy from other-file
  copy to somename
  
  -- With zzz
  Status:
  A somename
    other-file
  
  Diff:
  diff --git a/other-file b/somename
  copy from other-file
  copy to somename