Version Management
About 1 min
Version Management
Drawing version control with support for branches, patches, merge, and conflict resolution.
Online Examples
| Example | Description | Link |
|---|---|---|
| Create Branch | Create a new branch from a specified version | Online Demo{target="_blank"} |
| Save Version | Create a new Patch version | Online Demo{target="_blank"} |
| Merge Branch | Create two branches, modify, then merge - demonstrates complete branch workflow | Online Demo{target="_blank"} |
| Version History | View and revert versions | Online Demo{target="_blank"} |
| Conflict Resolution | Simulate two branches modifying the same entity causing conflict, demonstrates conflict resolution flow | Online Demo{target="_blank"} |
| User Auth Callback | Business system login, user identity passing, and permission check callback | Online Demo{target="_blank"} |
User Authentication Integration
To integrate WebCAD collaborative editing with your business system's user permissions, see the User Authentication Integration documentation.
Overview
WebCAD version management is similar to Git, supporting:
- Branches: Create independent branches from any version
- Patches: Save incremental changes
- Merge: Merge branches back to the main branch
- Conflict Resolution: Handle conflicts when the same entity is modified in different branches
Core API
Create Branch
const { VersionService } = vjcad;
// Create a new branch from the current version
const newBranch = await VersionService.createBranch({
mapid: 'drawing-id',
baseBranch: 'main',
basePatchId: 'patch-001',
newBranchName: 'feature-1'
});Save Version (Patch)
// Save current changes as a new Patch
const patch = await VersionService.savePatch({
mapid: 'drawing-id',
branch: 'feature-1',
message: 'Added new annotations'
});Merge Branch
// Merge branch to main
const mergeResult = await VersionService.mergeBranch({
mapid: 'drawing-id',
sourceBranch: 'feature-1',
targetBranch: 'main'
});
if (mergeResult.hasConflicts) {
// Handle conflicts
await handleConflicts(mergeResult.conflicts);
}Version History
// Get version history
const history = await VersionService.getHistory({
mapid: 'drawing-id',
branch: 'main'
});
// Checkout to a specific version
await VersionService.checkout({
mapid: 'drawing-id',
branch: 'main',
patchId: 'patch-001'
});Conflict Resolution
// Conflict resolution options
const resolveOptions = {
useSource: ['entity-1', 'entity-2'], // Use source branch version
useTarget: ['entity-3'], // Use target branch version
useManual: { // Manual resolution
'entity-4': customEntity
}
};
await VersionService.resolveConflicts(mergeResult.mergeId, resolveOptions);Version Management Concepts
| Concept | Description |
|---|---|
| Branch | Branch, independent version line |
| Patch | Patch, incremental changes from one save |
| Base | Base version, starting point of a branch |
| Merge | Merge, apply branch changes to target branch |
| Conflict | Conflict, same entity modified in different branches |