Search code examples
mercurialtortoisehg

Mercurial: File split into two files, how to track changes?


I'm using Mercurial via TortoiseHG for a project. Just came across a situation like the following:

public static class Example
{
    public static void ExampleMethod()   { ... }
    public static void UnrelatedMethod() { ... }
}

Where I've had to split a file into two files, one new, one old:

public static class Example
{
    public static void ExampleMethod()   { ... }
}

// In a new file:
public static class Unrelated
{
    public static void UnrelatedMethod() { ... }
}

I know how to handle renames via Mercurial, but in this case is there any way to get the Unrelated class file to point to / clone the history of Example at the time it was forked off? Otherwise, if someone reviews the history, they won't know about previous changes to UnrelatedMethod unless they specifically know to look into Example's history.


Solution

  • If you made proper copy (i.e. hg copy), then hg log -f Unrelated will follow history not just this file, but all it's ancestors too (hg help log)