|
|
Re: JGIt: pulling across directories. [message #1619234 is a reply to message #1616262] |
Mon, 16 February 2015 12:31 |
Pete Kowalsky Messages: 2 Registered: February 2015 |
Junior Member |
|
|
The code that worked was via configuration (no docs to point that out, but luckily git has some):
//uri is absolute FS path
PullCommand p = this.git.pull();
Config config = this.git.getRepository().getConfig();
config.setString("remote", "xxx", "url", "file://" + uri + "");
config.setString("remote", "xxx", "fetch", "+refs/heads/*:refs/remotes/*");
p.setRemote("xxx");
p.setStrategy(MergeStrategy.RECURSIVE).call();
The code I tried is same as you suggested and it was:
PullCommand p = this.git.pull();
p.setRemote(uri);
p.setStrategy(MergeStrategy.RECURSIVE).call();
Exception I receive is:
org.eclipse.jgit.api.errors.InvalidConfigurationException: No value for key remote./Users/peter/bin/repos/out/23423/prod/testrepo.url found in configuration
Fetching and full generating from DB took: 1648ms
at org.eclipse.jgit.api.PullCommand.call(PullCommand.java:247)
at versioning.JGit.pull(JGit.java:138)
at Processor.update(Processor.java:139)
at Main.mainCall(Main.java:139)
at Main.main(Main.java:62)
I think much changed from old api which had File option as argument. I like generic config option but... life is easier with default options (that File argument didnt do any harm to have).
Notice that I have two directories, one is initialized and second one too. They dont have remotes and I wanna pull from one to another (very basic). Its not common use case but this practice is useful in some back-end cases.
[Updated on: Mon, 16 February 2015 12:32] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03131 seconds