Merge is an overloaded word. There is a content merge and then there is a branch merge. A content merge is where you have edited a file and someone checked in a newer file, so the source control system will tell you to do a content merge before checking in the file (if it's interactive, it's a 3-way merge GUI).
A branch merge is migrating changes from one branch to another. If a source branch A has a file rock.cs that had been edited and file scissors.cs that had been deleted, merging these changes into a target branch B would result in a pending edit on file rock.cs and a pending delete on the file scissors.cs in the target.
Here's a simple example that uses the command line. The biggest differences between this and a “real-world“ example are the number of files involved (you may have thousands) and that you would probably have conflicts for a subset of the files (e.g., the same file was edited both in the source and in the target, resulting in the need to do a 3-way content merge).
The /i option is the shortcut for the "noprompt" option that makes everything non-interactive, as would be needed in batch script. Changes are committed in change sets, and the whole check in either succeeds or fails (it's atomic).
1. Create a workspace and add the files mentioned in the merge explanation above.
D:\project>h workspace /i /new MyProject D:\project>h add /r A A A: rock.cs scissors.cs D:\project>h checkin /i add A A: add rock.cs add scissors.cs Change set #4 checked in.
D:\project>h branch A B B B: rock.cs scissors.cs D:\project>h checkin /i branch B B: branch rock.cs branch scissors.cs Change set #5 checked in.
D:\project>h dir /r $/: $A $B $/A: rock.cs scissors.cs $/B: rock.cs scissors.cs 6 item(s)
D:\project>h branches A >> $/A << $/B Branched from version 1
D:\project>h edit A\rock.cs A: rock.cs D:\project>echo new line >> A\rock.cs D:\project>h delete A\scissors.cs A: scissors.cs D:\project>h checkin /i A: edit rock.cs delete scissors.cs Change set #6 checked in.
D:\project>h merge A B merge, edit: $/A/rock.cs;C5~C6 -> $/B/rock.cs;C5 merge, delete: $/A/scissors.cs;C5~C6 -> $/B/scissors.cs;C5 D:\project>h checkin /i B: merge, edit rock.cs merge, delete scissors.cs Change set #7 checked in.
D:\project>h history /i B\rock.cs Vers Date Chngset User Change Type Files ---- ---------- ------- ------------- -------------------- -------------------- 2 06/14/2004 7 buckh merge, edit $/B/rock.cs 1 06/14/2004 5 buckh branch $/B/rock.cs