Java Code Examples for org.eclipse.jgit.util.SystemReader

The following examples show how to use org.eclipse.jgit.util.SystemReader. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: netbeans   Source File: TransportCommand.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public final void run () throws GitException {
    SystemReader original = SystemReader.getInstance();
    String externalTool = original.getenv(PROP_ENV_GIT_SSH);
    boolean replace = externalTool != null;
    if ("true".equals(System.getProperty(PROP_GIT_SSH_SYSTEM_CLIENT, "false"))) { // NOI18N
        replace = false;
    }
    try {
        if (replace) {
            LOG.log(Level.WARNING, "{0} set to {1}, ignoring and using the default implementation via JSch", new Object[] { PROP_ENV_GIT_SSH, externalTool }); //NOI18N
            SystemReader.setInstance(new DelegatingSystemReader(original));
        }
        runTransportCommand();
    } finally {
        if (replace) {
            SystemReader.setInstance(original);
        }
    }
}
 
Example 2
Source Project: hop   Source File: UIGit.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public boolean commit( String authorName, String message ) {
  PersonIdent author = RawParseUtils.parsePersonIdent( authorName );
  // Set the local time
  PersonIdent author2 = new PersonIdent( author.getName(), author.getEmailAddress(),
      SystemReader.getInstance().getCurrentTime(),
      SystemReader.getInstance().getTimezone( SystemReader.getInstance().getCurrentTime() ) );
  try {
    git.commit().setAuthor( author2 ).setMessage( message ).call();
    return true;
  } catch ( Exception e ) {
    showMessageBox( BaseMessages.getString( PKG, "Dialog.Error" ), e.getMessage() );
    return false;
  }
}
 
Example 3
Source Project: netbeans   Source File: OpenGlobalConfigurationAction.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void performContextAction (final Node[] nodes) {
    Utils.postParallel(new Runnable () {
        @Override
        public void run() {
            File config = SystemReader.getInstance().openUserConfig(null, FS.DETECTED).getFile();
            if (!config.exists()) {
                if (shallCreate(config)) {
                    try {
                        if (!config.createNewFile()) {
                            LOG.log(Level.WARNING, "Git config not created: {0}", new Object[] { config.getPath() });
                        }
                    } catch (IOException ex) {
                        GitClientExceptionHandler.notifyException(ex, true);
                    }
                } else {
                    return;
                }
            }
            if (config.canRead()) {
                Utils.openFile(config);
            } else {
                LOG.log(Level.WARNING, "Cannot read Git config: {0}", new Object[] { config.getPath() });
            }
        }

    }, 0);
}
 
Example 4
@BeforeClass
public static void init() throws IOException {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());

	localRepo = ConfigServerTestUtils.prepareLocalRepo();
}
 
Example 5
@BeforeClass
public static void init() throws IOException {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());

	localRepo = ConfigServerTestUtils.prepareLocalRepo();
}
 
Example 6
@BeforeClass
public static void init() throws IOException {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());

	ConfigServerTestUtils.prepareLocalRepo();
}
 
Example 7
@BeforeClass
public static void init() throws Exception {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());

	ConfigServerTestUtils.prepareLocalRepo();
	ConfigServerTestUtils.prepareLocalSvnRepo(
			"src/test/resources/svn-config-repo", "target/repos/svn-config-repo");
}
 
Example 8
@BeforeClass
public static void init() throws Exception {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());

	ConfigServerTestUtils.prepareLocalRepo();
	ConfigServerTestUtils.prepareLocalSvnRepo(
			"src/test/resources/svn-config-repo", "target/repos/svn-config-repo");
}
 
Example 9
@BeforeClass
public static void init() throws IOException {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());

	ConfigServerTestUtils.prepareLocalRepo();
}
 
Example 10
@BeforeClass
public static void init() throws IOException {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());

	ConfigServerTestUtils.prepareLocalRepo();
}
 
Example 11
@BeforeClass
public static void init() throws IOException {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());

	ConfigServerTestUtils.prepareLocalRepo("encrypt-repo");
}
 
Example 12
@BeforeClass
public static void init() throws Exception {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());

	ConfigServerTestUtils.prepareLocalRepo();
}
 
Example 13
@BeforeClass
public static void init() throws Exception {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());

	ConfigServerTestUtils.prepareLocalRepo();
}
 
Example 14
@BeforeClass
public static void init() throws IOException {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());

	ConfigServerTestUtils.prepareLocalRepo();
}
 
Example 15
Source Project: onedev   Source File: GitUtils.java    License: MIT License 4 votes vote down vote up
public static PersonIdent newPersonIdent(String name, String email, Date when) {
	return new PersonIdent(name, email, when.getTime(), 
			SystemReader.getInstance().getTimezone(when.getTime()));
}
 
Example 16
Source Project: netbeans   Source File: TransportCommand.java    License: Apache License 2.0 4 votes vote down vote up
public DelegatingSystemReader (SystemReader sr) {
    this.instance = sr;
}
 
Example 17
Source Project: netbeans   Source File: ConnectionTest.java    License: Apache License 2.0 4 votes vote down vote up
public DelegatingSystemReader (SystemReader sr) {
    this.instance = sr;
}
 
Example 18
@BeforeClass
public static void initClass() {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());
}
 
Example 19
@BeforeClass
public static void initClass() {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());
}
 
Example 20
@BeforeClass
public static void initClass() {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());
}
 
Example 21
@BeforeClass
public static void initClass() {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());
}
 
Example 22
@BeforeClass
public static void initClass() {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());
}
 
Example 23
@BeforeClass
public static void initClass() {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());
}
 
Example 24
@BeforeClass
public static void initClass() {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());
}
 
Example 25
@BeforeClass
public static void initClass() {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());
}