У меня проблема с форматом даты для похвалы - после - до. мерзавецGit log commended date format java
"git -C " + RepositoryConstants.root + reponame + " log --pretty=format:\"%h|%an|%ad|%s\" --after='" + dateFrom___ + "' --before='" + dateTo___ + "' --date=iso");
Это то, что происходит в моей программе. и это не сработает. Но когда я копирую его, чтобы настроить его, точно так же, как когда у меня есть даты в формате «2016-02-05», но не с часами и минутами.
final Process p = Runtime.getRuntime().exec(string from upstair);
new Thread(new Runnable() {
public void run() {
BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = null;
try {
while ((line = input.readLine()) != null) {
Commit commit = new Commit();
System.out.println(">>> " + line);
String split[] = line.split("\\|");
...
}
} catch (IOException e) {
e.printStackTrace();
}
}
}).start();
p.waitFor();
Thread.sleep(1000);
return stuff;
private DateFormat outputFormatter = new SimpleDateFormat("YYYY-MM-dd HH:mm");
String dateFrom___ = "'" + outputFormatter.format(dateFrom__) + "'";
String dateTo___ = "'" + outputFormatter.format(dateTo__) + "'";
final Process p = Runtime.getRuntime().exec(new String[]{"git", " -C ", RepositoryConstants.REPOSITORY_ROOT + repo, " log"," --pretty=format:\"%h|%an|%ad|%s\"", " --after=", dateFrom___, " --before=", dateTo___, " --date=iso"});
Можете ли вы показать, как вы используете его в Java? – Ferrybig