Note that there are some explanatory texts on larger screens.

plurals
  1. PODVCS detect code block movement
    primarykey
    data
    text
    <p>I'm looking for a version control system that is able to detect if a function is moved inside a file. For example, there is this file "Foo.java" and this contains function "a()", "b()" and "c()".</p> <pre><code>public class Foo { void a() { } void c() { } void b() { } } </code></pre> <p>Now if user A changes method "c()" to actually do something:</p> <pre><code> void c() { System.out.println("Function c is called"); } </code></pre> <p>And user B sees the functions should be ordered different and moves "c()" under "b()":</p> <pre><code>public class Foo { void a() { } void b() { } void c() { } } </code></pre> <p>Now if they both push to the centralized repository I want the result to be:</p> <pre><code>public class Foo { void a() { } void b() { } void c() { System.out.println("Function c is called"); } } </code></pre> <p>Now what happens is that a conflict occurs and either user A or user B has to do a manual resolve. In my opinion this should be handled automatically or should be displayed in some way. A manual resolve is not a problem if the file is 'not that big' but a file containing 800+ lines is not that clear.</p> <p>Now I've tested git and mercurial and both cannot resolve this in the way I want. I've used subversion before and know this isn't handled and has some more shortcomings for my uses so I prefer a DVCS.</p> <p><strong>EDIT:</strong> What I (mainly) try to accomplish is to preserve the history of a function. I know that Git for example can show the history of certain lines. However if a function gets moved one can easily confuse the movement as the origin of the function. The DVCS should detect this movement since it must know about the history, like the movement of a file. Linus once said that one should (in case of a movement) only move and not modify a file, so that Git can 'see' the movement. I thought of Git maybe being able to track movements of chunks in a likewise manner.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload