mutableGroups and mutableDetails in Stash - bitbucket-server

What are mutableGroups and mutableDetials in Stash or Bitbucket used for?

Related

Git LFS cannot find object for new repo

I'm trying to push some UE4 assets from a local brand new git project to a new github repo. I started with:
> git init
> git lfs track *.uasset
> git lfs track *.umap
> git add .git*
> git add path/to/asset.uasset
> git commit -m "init repo"
> git remote add origin git#github:my_repo.git
> git push -u origin master
Then I get:
Git LFS upload failed: 0% (0/1), 0 B | 0 B/s
(missing) Content/Assets/Landscape/M_Landscape_Master.uasset (9ec478c231daf870ad7ab6535c3beb403a63f68a305073506decd24ac66ad122)
hint: Your push was rejected due to missing or corrupt local objects.
hint: You can disable this check with: `git config lfs.allowincompletepush true`
error: failed to push some refs to 'github.com:my_repo.git'
git lfs push --all origin master gives the same error here.
git lfs fetch --all returns:
fetch: 1 object found, done.
fetch: Fetching all references...
[9ec478c231daf870ad7ab6535c3beb403a63f68a305073506decd24ac66ad122] Object does not exist on the server: [404] Object does not exist on the server
error: failed to fetch some objects from 'https://github.com/my_repo.git/info/lfs'
My environment:
Win10
git: git version 2.36.1.windows.1
lfs: git-lfs/3.1.4 (GitHub; windows amd64; go 1.17.8)

GitHub deleted my previous commits

Please! I lost all my day's work.
I created a github repository... I've been working all day doing git add -A and commit but I never did a push. I changed a readme directly on the page (not knowing I was going to have problems to merge those same branches).
When I tried to make git push after all day's rok the following happened:
To https://github.com/NEGU93/Steganography.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/NEGU93/Steganography.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
So I tried ta git pull --rebase but it started crashing some things I don't know what it is:
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From https://github.com/NEGU93/Steganography
6161279..44d1f0f master -> origin/master
0 [main] expr 8516 open_stackdumpfile: Dumping stack trace to expr.exe.stackdump
0 [main] cat 15632 open_stackdumpfile: Dumping stack trace to cat.exe.stackdump
0 [main] rm 4660 open_stackdumpfile: Dumping stack trace to rm.exe.stackdump
^C
I put ctrl+C to stop the crashin there. So I made a git fetch and then a git push of my work:
fatal: You are not currently on a branch.
To push the history leading to the current (detached HEAD)
state now, use
git push origin HEAD:<name-of-remote-branch>
So I did as suggested and made a git push to master:
git push origin HEAD:master
Counting objects: 6, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 1.49 KiB | 0 bytes/s, done.
Total 5 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), done.
To https://github.com/NEGU93/Steganography.git
44d1f0f..c3b8393 HEAD -> master
But now when I got back the work was not there... Help! I don't know what to do and I'm starting to panic. I think the problem is with git fetch. Is there a way to get all my work back???
Use git reflog to see past commits, then use the commit's hash to reset hard e.g.:
git reset --hard e870e41
See How can I recover a lost commit in Git?

Jenkins Git Plugin

I am getting the below error when attempting a Jenkins build of a project from a GitHub repository for a poc. Jenkins is a local install and I am using the https address for git with thge username and password I use to login to GitHub. Can anyone offer me some pointers here as I am new to both Jenkins and GitHub
Building in workspace C:\Program Files (x86)\Jenkins\workspace\AdventureWorks2014 - 1. Build
Cloning the remote Git repository
Cloning repository https://github.com/h020905a/AdventureWorks2014.git
> git.exe init C:\Program Files (x86)\Jenkins\workspace\AdventureWorks2014 - 1. Build # timeout=10
Fetching upstream changes from https://github.com/h020905a/AdventureWorks2014.git
> git.exe --version # timeout=10
using GIT_ASKPASS to set credentials
> git.exe fetch --tags --progress https://github.com/h020905a/AdventureWorks2014.git +refs/heads/*:refs/remotes/origin/*
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Error performing git command
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1793)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1513)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:64)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:315)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:512)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1057)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1097)
at hudson.scm.SCM.checkout(SCM.java:495)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1278)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
at hudson.model.Run.execute(Run.java:1728)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:404)
Caused by: org.jvnet.winp.WinpException: Failed to read RT_USER_PROCESS_PARAMETERS error=299 at envvar-cmdline.cpp:151
at org.jvnet.winp.Native.getCmdLineAndEnvVars(Native Method)
at org.jvnet.winp.WinProcess.parseCmdLineAndEnvVars(WinProcess.java:126)
at org.jvnet.winp.WinProcess.getCommandLine(WinProcess.java:102)
at hudson.util.ProcessTree$Windows$1.getArguments(ProcessTree.java:444)
at hudson.plugins.msbuild.MsBuildKillingVeto.vetoProcessKilling(MsBuildKillingVeto.java:56)
at hudson.util.ProcessTree$OSProcess.getVeto(ProcessTree.java:242)
at hudson.util.ProcessTree$Windows$1.killRecursively(ProcessTree.java:425)
at hudson.util.ProcessTree.killAll(ProcessTree.java:145)
at hudson.Proc$LocalProc.destroy(Proc.java:380)
at hudson.Proc$LocalProc.join(Proc.java:353)
at hudson.Proc.joinWithTimeout(Proc.java:166)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1780)
... 15 more
ERROR: null
Finished: FAILURE
If your github login password has special characters, then the issue you are facing might be similar to the issue described in this ticket:
https://issues.jenkins-ci.org/browse/JENKINS-38655
You can try getting your job to use JGit. Quoting from Mark Waite's answer in the above mentioned ticket:
"If you're not using TFS, but have special characters in the password of the specific user (like caret or ampersand or single quote or double quote), then this may be a duplicate of JENKINS-38194. The work around in that case may be to switch that job from using the command line git implementation to use the JGit implementation. The JGit implementation needs to be enabled globally first from "Manage Jenkins", "Global Tool Configuration", "Git", then there will be a pick list in each job which will allow you to choose whether that job should use command line git or JGit."
Resolved the issue by switching the branch in github to master and making the repo public.

LIbGit2Sharp: list all the pull request's authors

Using the LibGit2Sharp library, I'm trying to list all authors of pull requests on the master branch of a repo. I don't see anything in the docs, intellisense, or through search that has an example of this. Any pointers??
I have constructed the code below, but I'm getting the following error message An unhandled exception of type 'LibGit2Sharp.RepositoryNotFoundException' occurred in LibGit2Sharp.dll. Browsing around, it seems that the references I find are to local cloned repos and not remote repositories.
static void Main(string[] args)
{
var co = new CloneOptions();
co.CredentialsProvider = (_url, _user, _cred) => new UsernamePasswordCredentials
{
Username = "username",
Password = "password"
};
var clonedRepoPath = Repository.Clone(url, "path/to/clone", co);
using (var repo = new Repository(clonedRepoPath))
{
foreach (Commit commit in repo.Commits)
{
Console.WriteLine(commit.Author.Name);
}
Console.WriteLine("Press any key to continue...");
Console.ReadLine();
}
}
}
}
...list all the pull requests ......
First of all, “pull requests” are a DVCS workflow method, and are not a feature of git. Most people inherently, and incorrectly, think it is a part of git. Github.com (and others) have a pull request workflow system that includes items such as a git merge, topic discussion, continuous integration (CI) hooks, issue referencing, user permissions, etc.. with ONLY the git merge being actually from the git DVCS.
That said, within a git repository, Github-style pull requests are merges between two commit-ishs (usually merging from topic branch to a master branch, but this is not a requirement) and thus the 'pull request' commit have two parents.
FYI: For merges that have three(+) parents, see this answer
So back to your question:
list the authors of all the pull requests on the master branch of a repo
That statement becomes the following git cmd:
git log master --merges --pretty=format:"%an %s" becomes:
In translating that to libgit2sharp:
// find the master branch in the repo
var masterBranch = repo.Branches.Single (branch => branch.FriendlyName == "master");
// Filter the branch's commits to ones that are merges
var mergeList = masterBranch.Commits.Where (p => p.Parents.Count () >= 2);
// Display the merge commits (pull requests)
foreach (Commit commit in mergeList)
{
Console.WriteLine("{0}\t{1}", commit.Author.Name, commit.MessageShort);
}
Example output of a github repo that uses pull requests:
João Matos Merge pull request #1966 from angeloc/master
Zoltan Varga Merge pull request #1965 from akoeplinger/fix-flaky-test
João Matos Merge pull request #1963 from angeloc/patch-1
Rodrigo Kumpera Merge pull request #1912 from ludovic-henry/threadpool-managed-asyncresult
Zoltan Varga Merge pull request #1959 from alexrp/master
Zoltan Varga Merge pull request #1958 from rolfbjarne/aot-error-reporting
Marek Safar Merge pull request #1955 from LogosBible/servicepoint_nre
...
Update:
Based upon the comment, libgit2sharp is not going to give the user what they want, you need to use the Github api.
Using Github Api via the Octokit library (you can directly make the Github REST calls or use another lib.), you can request all the open pull requests fairly easily:
public static async Task getPullRequests ()
{
var client = new GitHubClient (new ProductHeaderValue ("PlayScript"));
// Login Credentials if you need them for an enterprise acct/repo
// client.Credentials = GithubHelper.Credentials;
var connection = new Connection (new ProductHeaderValue ("PlayScript"));
var api = new ApiConnection (connection);
var pullrequests = new PullRequestsClient (api);
pulls = await pullrequests.GetAllForRepository ("PlayScriptRedux", "playscript");
}
....
Task.WaitAll(getPullRequests());
foreach (var pullrequest in pulls) {
Console.WriteLine (pullrequest.IssueUrl);
}
That would list one open pull request for my playscript repo under the PlayScriptRedux organization, i.e. console output:
https://api.github.com/repos/PlayScriptRedux/playscript/issues/89
Look at the Octokit pull request test fixture for more info
Also review the Github pull requests api info

How to set the upstream branch for new local branch with JGit

I use the following code to create a new branch from origin/master:
CreateBranchCommand branchCmd = git.branchCreate();
branchCmd.setForce(true);
branchCmd.setName("newFeatureBranch");
branchCmd.setUpstreamMode(SetupUpstreamMode.SET_UPSTREAM);
branchCmd.setStartPoint("origin/master");
branchCmd.call();
After running this code I get a new local branch with the following upstream:
But that is not what I want. Its upstream should be set to refs/heads/newFeatureBranch:
How do I set the upstream in the new branch?