original:
if __name__ == "__main__":
myparams = {"server":"mpilgrim", \
"database":"master", \
"uid":"sa", \
"pwd":"secret" \
}
cutting of bzr diff:
if __name__ == "__main__":
myparams = {"server":"mpilgrim", \
@@ -15,4 +22,6 @@
"pwd":"secret" \
}
What means the '@@ -15,4 +22,6 @@' part of bzr diff and why does it overwrite two lines?
"database":"master", \
"uid":"sa", \
You have provided excerpts from a context diff, which shows both lines that are the same in both files and lines that are changed. However, the excerpts you have selected don't actually show any changed lines. (Those would be preceded with
-
or+
characters, depending on whether they're being removed or added.)@@ -15,4 +22,6 @@
means that4
lines starting with line15
in the old file are are changed (or not changed, but shown as context), and correspond to6
lines starting with line22
in the new file. (The simplest and overwhelmingly most common way for this to occur is that the number of lines added in the new file exceeds the number of lines removed in the new file by 7, such that what started on line15
in the old file starts on line22
in the new file, prior to application of the changes about to be specified.)Since this is a context diff, it provides some lines for context that don't specify changes. This is useful to allow people editing the files (developers/maintainers, when it's source code, as in this case) to know what's going on by skimming the diff. But it has the other useful purpose of making it possible, in many cases, to apply a diff created against one version of a file against another version of the same file, provided that it doesn't change the exact same lines that were already changed (i.e., that were changed after the diff was created but before it is being applied).
The following lines are presumably present, as context, in the diff, because there was a change shortly before them (so they are context provided after a change):
Whereas these lines are presumably present, as context, in the diff, because there is going to be a change shortly after them (so they are context provided before a change):
These lines are presumably not sufficiently close to any change specified in the diff to be included as context:
That's why they seem as though they are missing in the diff. They're not really missing, because a diff is not supposed to show you the entire file. The take home message of all this is that their absence is not because the diff is specifying that they be removed. It is certainly not specifying that--if it were, it would have to include them (with
-
signs before them to indicate their removal).(I say presumably above not because there is any strong likelihood that this isn't what is going on, but because while the
diff
utility will create diffs with specified numbers of before and after context lines, you could, if you wanted, manually create or modify a diff so that it had more or fewer context lines in some places than in others, and it would still be a valid diff, provided that, where necessary, the numbers in@@
lines where changed to match.)For more information about
diff
(thediff
,patch
,diff3
, andsdiff
utilities, and also thediff
/patch
format), see the GNU diff documentation. In particular, you may be interested in the section on the part about the unified format.