JGit plumbing API - commit new or modified file to non-current branch - jgit

Sorry, relative novice, but I have not been able to find specific example to address this. Working on a service that is using Git to store configuration documents. They would be worked on in branches until "published".
I've been able to do all the querying and fetching of documents from any branch in the local repository where the service would run, without having to "checkout" branch into working directory. I would like to do the same with a save operation.
I've found examples of using ObjectInserter, TreeFormatter and CommitBuilder to do this, but no explicit/explained example of doing this to specific branch that would produce the same results as switching, adding and committing with porcelain API.
I've played around with RefUpdate after the commit, and think I'm on the right track, but could use some help.
Thanks in advance

Related

Working with two separate repos and syncing changes between them

I am a somewhat new/basic git user and I'm having a problem that I can not seem to find an answer for. I am trying to figure out a way I can store two different branches from a github repo locally on my computer. My understanding is that when I clone a repo to my laptop from Github, it also downloads all of the branch and commit history my local machine. I want to continue to use github as a version control/backup for my project. However, I am working with colleagues who understand git less than I do so I am trying to find a way to help keep everything simple for them at the same time.
Here is a description of the situation:
We are developing an analysis in RStudio to examine information about quantitative writing in college students.
I am writing the R analysis scripts and want to maintain a safe backup with github
I am sharing the project files with my colleagues via Google drive since they do not know how to use git/ github
I have reached a point where I am going to change the fundamental file structure of the project. However, I do not want to disrupt their ability to perform analyses while I am making these changes.
My colleagues need to be able to save analysis outputs to the project folder where they are synced back to me via Google Drive and then pushed to GitHub.
I can think of two ways to handle this situation but both seem to have problems that I can't see around.
Create a branch in github, make changes to the branch and then merge the branch with the master
This won't work because I am sharing the files via Google Drive and you can only have one branch of a repo on your local machine at a time. Once clone the branch to my machine, that is what gets shared via Google Drive and any changes I make disrupts everyone else's workflow.
Create a second copy of my repo, make changes there, and then push those changes to the original repo that gets shared to colleagues via Google Drive ##
I have no idea how to do this. Everything I have read discusses how to push/pull between different github users. How can I do this as a single user?
Did I forget anything important?
Any help/suggestions greatly appreciated.
You can do it all in the same directory by adding a second remote origin, if you've already added GitHub as 'origin', then run:
git remote add gdrive https://example.com/path/to/repo.git
then you can push up your changes you've made to the two repos
to push to GitHub:
git push origin
and then to push to GitHub
git push gdrive
See this github doc page

Writing an appspec.yml File for Deployment from S3 (and/or Bit Bucket) to AWS CodeDeploy

I'd like to make it so that a commit to our BitBucket repo (or S3 Bucket) automatically deploys code (using CodeDeploy) to our EC2 instances. I'm not clear what to use for the 'source' and 'destination' entry under the 'files' section in the appspec.yml file and also I am not cleared what to mention in BeforeInstall and AfterInstall under 'Hooks' section. I've found some examples on Google and AWs documentation but I am confused what to mention in above fields. The more I am exploring more I am getting confused.
Consider I am new to AWS Code Deploy.
Also it will be very helpful if someone can provide me step y step link how to configure and how to automate the CodeDeploy.
I was wondering if someone could help me out?
Thanks in advance for your help!
Thanks for using CodeDeploy. For new users, I'd like to recommend the following things to do:
Try to run First Run Wizard on console, it will should you the general process how the deployment goes. It also provide a default deployment bundle, also an appspec file included.
Once you want to try a deployment yourself, the Get Started doc is a great place to help you with some pre-requiste settings like IAM role
Then probably try some tutorials for a sample app too, which gives you some idea about deployment groups, deployment configuration, revision and so on.
The next step should be create a bundle for your own use cases, Appspec file doc would be a great place to refer. And for your concerns about BeforeInstall and AfterInstall, if your application doesn't need to do anything, the lifecycle events can be left as empty. BeforeInstall can be used to for for preinstall tasks, such as decrypting files and creating a backup of the current version, while AfterInstall can be used for tasks such as configuring your application or changing file permissions.
Now it comes to the fun part! This blog talks about details about how to integrate with Github(similar for Bitbucket). It's a little long, but really useful, and it also includes how to do automatically deployment once there is a new pushed commit. Currently Jenkins and CodePipline are really popular for auto-triggered deplyoments, but there are always a lot of other ways can achieve the same purpose like Lamda and so on

R: RStudio: How to check out an existing branch, modify it and commit back to GitHub (Windows machine)

I have followed every advice on http://r-pkgs.had.co.nz/git.html and on the subsection http://r-pkgs.had.co.nz/git.html#git-branch and I am still getting error.
The steps I need/did (different from what Hadley's page dictates).
grab URL of GitHub repo (e.g, https://github.com/OHDSI/Achilles.git )
create versioned project in RStudio with this URL
set up my global user names for git
select a dev branch here (for example devXYZ)
At this point I got "detached at origin/devXYZ) message.
Per instructions in Hadley book - I tried to do fix this using this command
git push --set-upstream origin devXYZ
but it fails. The error is: origin does not appear to be a git repository or src refspec devXYZ does not match any
I tried fixing it with doing this command (may be wrong)
git remote add origin https://github.com/OHDSI/Achilles.git
I am using windows, latest R, latest RStudio, latest git from https://git-scm.com/download/win
EDIT: I also tried making a new branch using the recommended mechanism but it also fails. The goal is to get instructions where there is not git init and the whole process starts with an URL and new project in RStudio.
The desired future steps to work would be 5. modify and commit into the devXYZ branch.
THIS ONLY APPLIES TO NON-MASTER BRANCHES:
If you are newbie to git - simply don't try to do the git part in R at all.
Instead, use GitHub Desktop or SourceTree.
Point that tool to the desired repo, switch to desired branch
Start RStudio and do any development
Close RStudio and use that external tool to perform any git steps.
FOR MASTER BRANCHES:
integrated RStudio git implementation works great.
I think I might know what the problem is. You're trying to push directly to the main repo. I'm guessing you're not one of the main contributors for that repo so it won't allow you to create a branch there directly. I'm guessing in that book he's probably using his own repository as an example rather than using an existing one
The reason you're getting that error is because that branch doesn't exist on the remote repo so it can't get the reference to it which is inferred from this src refspec devXYZ does not match any
The preferred workflow is to work on a fork of the main repo (basically its your own personal copy of the main repo that is stored on the server). Even if you end up as a contributor at some point I think this is a good workflow to follow
Here's a good explanation on how use the fork workflow. There's other information on stackoverflow as well
Once you've made updates you'd create what's called a pull request to the original repo (commonly referred to as upstream). This basically is a request to merge your changes from the fork into the main repo. This allows the repo owner to review the changes and decide whether to accept them or make changes
Since you're just going over a tutorial I'd say use your fork as the origin wherever its used in the book for now

How do you delete Phabricator project or task

I use Phabricator for code review, but I can't delete a project once it was created. The only thing I can do is change the project status from active to archived. The other problem is Task, same to project, I can't delete a task once it was created.
Sometimes, people try to test Phabricator, maybe he or she creates some mock projects, it makes sense to delete them after testing.
It is possible, but only by using the command line administration tools.
Remove a task? ./phabricator/bin/remove destroy TASK-ID (ie: T1, T23)
Remove a project? ./phabricator/bin/remove destroy PHID-PROJ-6i6ofxwwz4xybdvg7oa5
Here is how to find the PHID: How do you find the PHID of a Phabricator object?
I've asked the Phabricator developer on IRC, user can't delete a project or task, this is designed on purpose, the only way to do it is archive project or close task. Refer to his reply as below:
We do not plan to add that feature, the feature would create a lot of problems. For example, some user could delete your stuff and you'd have no way to tell who did it. If a user closes or archives your stuff, it says "alincoln closed this task." Another problem is that a project may have thousands or millions of objects attached to it. If you delete the project, either all of those objects become attached to an empty/invalid project, or we need to run some sort of background cleanup process. And there's no way to undo deletion, so users who make mistakes can't recover from it.

Alfresco failed to find new folder

I'm using alfresco throw cmis.
On one of our environment, we have an issue.
We want to create a folder and put some docs in it.
This works fines in all our env except one.
In this one, we can create the folder.
But when we do a search to find the folder, the folder isn't found.
After that i can find it with the share gui.
I have no error message in the share app.
Does any one have an idea on what could be the issue?
Promoting a comment to an answer...
When using Alfresco with SOLR, you need to be aware that the SOLR index isn't quite real-time. Close to real time, sure, but it's asynchronous so there's always a lag. (It's an eventually consistent index, not a fully realtime one)
There's a lot of information on the Alfresco and SOLR Wiki, including the way you can query what the current lag is.
If the lag is very low (eg a lightly loaded system), you can find that SOLR will catch up almost instantly, and newly created items will show instantly in the search results. However, it's more normal to expect to have to wait a little bit, especially on more loaded systems.
If no new results are showing up even after several minutes, you'll want to follow the instructions on the wiki or the SOLR Monitoring and Troubleshooting docs to work out why and fix.

Resources