Tutorial :How well does Python's whitespace dependency interact with source control with regards to merging?


I'm wondering if the need to alter the indentation of code to adjust the nesting has any adverse effects on merging changes in a system like SVN.

This is a really open ended question. I'm sort of fishing for information/anecdotes here.

Edit: Thanks all! I'd accept an answer but which one? I up moded them all.


It works fine so long as everyone on the project has agreed to use the same whitespace style (spaces or tabs).

But I've seen cases where a developer has converted an entire file from spaces to tabs (I think Eclipse had that as a feature, bound to Ctrl+Tab!), which makes spotting diffs near impossible.


I've used python with SVN and Mercurial, and have no hassles merging.

It all depends on how the diffing is done - and I suspect that it is character-by-character, which would notice the difference between one level of indent and another.


Generally source control systems merge on a line-by-line basis by default. I have found that merging Python code is no different from merging any other source code that is reasonably indented. If one programmer wraps a block of code in an if statement (indenting the whole block), and another programmer modifies something inside the block, then there will be a merge conflict. Fortunately, the conflict in this case is super easy to resolve.

If you use an external merge tool, then your tool may support more detailed textual merging algorithms that take the above scenario into account automatically.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »