Skip to content

Commit eab9752

Browse files
authored
Update README.md
1 parent e3f2794 commit eab9752

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,18 @@ LWC usage scenario:
139139
- OBSOLETE
140140
- `IVCSLockedWorkingCopy.close()` method has been called. Corresponding folder is unlocked and could be used by other `IVCSLockedWorkingCopy` instances. `IVCSLockedWorkingCopy` instance with this state should not be used anymore.
141141
- If a Working copy can not be reused due of VCS system data damage (e.g. .git, .svn folders) or due of vcs Working Copy can not be cleaned, reverted, switched, checked out etc, execute `IVCSLockedWorkingCopy.setCorrupted(true)`. LWC folder will be deleted on close.
142+
- Code snippet
143+
```java
144+
public static final String WORKSPACE_DIR = System.getProperty("java.io.tmpdir") + "scm4j-vcs-workspaces";
145+
public static main(String[] args) {
146+
IVCSWorkspace workspace = new VCSWorkspace(WORKSPACE_DIR);
147+
String repoUrl = "https://github.com/scm4j/scm4j-vcs-api";
148+
IVCSRepositoryWorkspace repoWorkspace = workspace.getVCSRepositoryWorkspace(repoUrl);
149+
try (IVCSLockedWorkingCopy wc = repoWorkspace.getVCSLockedWorkingCopy()) {
150+
// wc.getFolder() is locked folder
151+
}
152+
}
153+
```
142154

143155
# Folder structure
144156
- Workspace Home folder (e.g. c:\temp\scm4j-vcs-workspces\)

0 commit comments

Comments
 (0)