Skip to content

Instantly share code, notes, and snippets.

@aras-p
Last active September 28, 2021 10:02
Show Gist options
  • Save aras-p/8289222 to your computer and use it in GitHub Desktop.
Save aras-p/8289222 to your computer and use it in GitHub Desktop.
hg churn and log cheat sheet, ono graphql

Git

Fetch single branch (trunk): git fetch origin trunk:trunk (add -u flag when already on that branch)

Make a new worktree (similar to hg share): git worktree add --no-checkout --detach ../mynewfolder

Converting Hg repo to Git:

; get https://github.com/frej/fast-export somewhere
; clone hg repo
hg clone repourl clonedirhg
; convert Hg largefiles to regular files
hg lfconvert --to-normal clonedirhg clonedirhg-nolf
; init git repo and convert
mkdir clonedirgit
cd clonedirgit
git init .
../path/to/fast-export.sh -r ../clonedirhg-nolf
; convert files to Git LFS
git lfs migrate import --everything --verbose --include="*.png,*.jpg,*.tga"

Hg

Graph of total commits by month, over last year:

hg churn -f "%Y-%m" -s -c -d "-365"

List of my commits over last year:

hg log -k aras -d "2018-01-01 to 2018-12-31" --template "{short(node)} {user(author)} {firstline(desc)}\n" >mycommits.txt

My lines changed count over last year (takes ages):

hg churn -r "user(aras)" -d "2018-01-01 to 2018-12-31" --diffstat

Commits over last 30 days by authors:

hg churn -d "-30" -c

Git commits since date by authords:

git shortlog -sne --since="01 Jan 2020"

Figuring out size of branch merge (see size of tmp.hg after the command):

hg bundle -v -r my/branch/name --base trunk tmp.hg

Ono

Ono list of PRs for an author (https://ono.unity3d.com/_admin/graphql):

{
  repository(name: "unity/unity") {
    pullRequests(user: {username: "aras"}, includeClosed: true) {
      nodes {
        id
        created
        origin { name }
        title
        iterations { id }
      }
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment