小编Gan*_*ana的帖子

使用JGit或EGit - directory1\myfile.txt将文件夹中的文件添加到Github

*在此问题的底部添加了最终工作计划*

我能够使用org.eclipse.egit.github.core java库向GitHub添加一个文件(代码示例来自这里:https://gist.github.com/Detelca/2337731)

但我无法给出像"folder1\myfile.txt"或"folder1\folder2\myfile.txt"这样的路径

我试图找到一个简单的例子来添加文件夹下的文件,但实际上无法找到它.

有关此示例的任何帮助吗?

下面是我正在使用的代码:(配置详细信息,如用户名,reponame在方法addFileToGH()中)

import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.List;

import org.eclipse.egit.github.core.Blob;
import org.eclipse.egit.github.core.Commit;
import org.eclipse.egit.github.core.CommitUser;
import org.eclipse.egit.github.core.Reference;
import org.eclipse.egit.github.core.Repository;
import org.eclipse.egit.github.core.RepositoryCommit;
import org.eclipse.egit.github.core.Tree;
import org.eclipse.egit.github.core.TreeEntry;
import org.eclipse.egit.github.core.TypedResource;
import org.eclipse.egit.github.core.User;
import org.eclipse.egit.github.core.client.GitHubClient;
import org.eclipse.egit.github.core.service.CommitService;
import org.eclipse.egit.github.core.service.DataService;
import org.eclipse.egit.github.core.service.RepositoryService;
import org.eclipse.egit.github.core.service.UserService;

public class GHFileWriter {

    public static void main(String[] args) {
        try {
            new GHFileWriter().addFileToGH("myfile.txt", "some file content");
            //new GHFileWriter().addFolderToGH("folder1");
        } catch (IOException e) {
            // TODO …
Run Code Online (Sandbox Code Playgroud)

java github egit jgit

8
推荐指数
1
解决办法
1805
查看次数

将一个 git 存储库的问题链接到另一个存储库的提交

我有两个项目“项目-A”和“项目-B”。这些问题在“项目-A”中报告,但实际开发在“项目-B”中进行。

在每个提交评论中引用“project-A”是具有挑战性的。我正在探索一个更好的选择来将“项目-A”的问题链接到“项目-B”代码提交。一个简单的问题是,如果开发人员在“project-B”中提交评论“#23 fixed”,它应该在“project-A”的相关问题评论历史中可见。

git github repository

5
推荐指数
1
解决办法
3220
查看次数

从控制器访问模型 - SAPUI5

我在Component.js中添加了一个命名模型.我可以从任何视图访问带有其名称的模型,但我想从其中一个对我不起作用的控制器访问此模型.

sap.ui.core.getModel("modelName")无效,sap.ui.getCore().getModel("modelName")也无效.

如何从控制器中引用其包含的Component和命名模型?

谢谢

加纳

sapui5

0
推荐指数
2
解决办法
1万
查看次数

列表项的 setSelected 方法不会触发选择事件 - SAPUI5

我试图在主视图中选择列表的第一项。我正在从 Detail 控制器执行此操作。我可以选择列表中的项目,但它不会触发事件以在“详细信息”视图中显示详细信息。

主视图.xml

<List id="idMasterList" mode="{device>/listMode}" select="onSelect" 
                noDataText="{i18nMaster>masterListNoDataText}"  
                items="{  path: '/', sorter: {path: 'name'} }" icon="sap-icon://refresh">
            <items>
              <StandardListItem id="idStandardItem" type="{device>/listItemType}"  
                tooltip="{name}" 
                title="{name}"
                info="{total}/{due}" 
                /> 
            </items>                            
        </List>
Run Code Online (Sandbox Code Playgroud)

详细信息.controller.js

sap.ui.getCore().byId("__xmlview2--idMasterList").getItems()[0].setSelected(true);
Run Code Online (Sandbox Code Playgroud)

我找不到任何可以直接解决这个问题的信息(或)我没有得到它!!!

任何帮助表示赞赏。

谢谢

sapui5

0
推荐指数
1
解决办法
1万
查看次数

标签 统计

github ×2

sapui5 ×2

egit ×1

git ×1

java ×1

jgit ×1

repository ×1