monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-devel] "monotone diff" can not use as input for patch, if top


From: Henry Nestler
Subject: [Monotone-devel] "monotone diff" can not use as input for patch, if top lines changed or added
Date: Wed, 14 Sep 2005 20:27:38 +0200
User-agent: Mozilla Thunderbird 0.6 (Windows/20040502)

Hello,

I figured out, why sometimes a diff file can not clean use as input for patch. The diff was created with "monotone diff". Version 0.21 and 0.22 give same result.

The error message from patch is:
> Hunk #1 FAILED at 1.
> 1 out of 1 hunk FAILED -- saving rejects to file file.sh.rej

The header in diff file seens good, but my patch don't understand more than 3 lines before changing? Perhaps is a bug in my patch program, but monotone should create a standard format.

Versions:
patch 2.5.9
diff (GNU diffutils) 2.8.1
monotone 0.21 (base revision: e65bc11b6670a0b2ed8e72214cb81d94e6a9a2d1)
monotone 0.22 (base revision: 69129c6df327273da0483a0277a72be1801a9a27)
Distribution: SuSE 9.0 Linux


Now a sample.

1. Create file for starting
>>> cat file.sh >>>
#!/bin/sh

# This is line 3 with a comment

echo "This is line 5"

# Line 7 before patch
# Line 8 before patch
# Line 9 before patch
# Line 10 before patch
<<< end cat <<<


2. Add and commit this file
        monotone --db=/tmp/test.db --branch="testing" setup .
        monotone add file.sh
        monotone commit


3. Add three lines near the top of file at lin numer 7. I added 3 lines. This is the file now:
>>> cat file.sh >>>
#!/bin/sh

# This is line 3 with a comment

echo "This is line 5"

# New line 7 added
# New line 8 added

# Line 7 before patch
# Line 8 before patch
# Line 9 before patch
# Line 10 before patch
<<< end cat <<<


4. Create a diff
        monotone diff > changes.diff


5. Do a clean checkout of committed revision in a fresh new directory.
        monotone --db=/tmp/test.db --branch="testing" co testout


6. Use the diff file for patching in
        patch -p0 < changes.diff
This give the error and store the block in a rej-file.


7. If I diff the old and new file with diffutils give a other output as "monotone diff". Diff not starts at line 1. Diff starts three lines before the first changed line.
        diff -Naur testout/file.sh committed/file.sh > fromdiff.diff

All files have attached.


--
Henry Nestler
# 
# patch "file.sh"
#  from [4fc89c084c8ec1d4194a8e94fd00a376211fbda4]
#    to [edadf37dd53703674ca5c61d2494665cb3bad6f7]
# 
==========================================================================================================================
--- file.sh     4fc89c084c8ec1d4194a8e94fd00a376211fbda4
+++ file.sh     edadf37dd53703674ca5c61d2494665cb3bad6f7
@@ -1,9 +1,12 @@
 #!/bin/sh
 
 # This is line 3 with a comment
 
 echo "This is line 5"
 
+# New line 7 added
+# New line 8 added
+
 # Line 7 before patch
 # Line 8 before patch
 # Line 9 before patch
--- testout/file.sh     2005-09-14 19:43:20.000000000 +0200
+++ committed/file.sh   2005-09-14 19:41:15.000000000 +0200
@@ -4,6 +4,9 @@
 
 echo "This is line 5"
 
+# New line 7 added
+# New line 8 added
+
 # Line 7 before patch
 # Line 8 before patch
 # Line 9 before patch
#!/bin/sh

# This is line 3 with a comment

echo "This is line 5"

# New line 7 added
# New line 8 added

# Line 7 before patch
# Line 8 before patch
# Line 9 before patch
# Line 10 before patch
#!/bin/sh

# This is line 3 with a comment

echo "This is line 5"

# Line 7 before patch
# Line 8 before patch
# Line 9 before patch
# Line 10 before patch
monotone 0.22 (base revision: 69129c6df327273da0483a0277a72be1801a9a27)
Running on: Linux 2.6.12.5-co-0.7.1-hn2 #2 Tue Sep 13 01:08:35 CEST 2005 i686
Changes since base revision:

new_manifest [e8cb9a1b407e1e7ce561f9771c34d7b28fe157c2]

old_revision [69129c6df327273da0483a0277a72be1801a9a27]
old_manifest [e8cb9a1b407e1e7ce561f9771c34d7b28fe157c2]


  Generated from data cached in the distribution;
  further changes may have been made.

  Generated from data cached in the distribution;
  further changes may have been made.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]