{"id":13822486,"url":"https://github.com/quark-zju/gitrevset","last_synced_at":"2025-04-25T19:32:13.219Z","repository":{"id":62439539,"uuid":"291964014","full_name":"quark-zju/gitrevset","owner":"quark-zju","description":"Revset DSL for Git","archived":false,"fork":false,"pushed_at":"2020-10-18T05:42:36.000Z","size":85,"stargazers_count":16,"open_issues_count":1,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-04T02:41:27.418Z","etag":null,"topics":["git","revset"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/quark-zju.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-01T10:12:11.000Z","updated_at":"2025-04-03T15:35:05.000Z","dependencies_parsed_at":"2022-11-01T22:00:50.576Z","dependency_job_id":null,"html_url":"https://github.com/quark-zju/gitrevset","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quark-zju%2Fgitrevset","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quark-zju%2Fgitrevset/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quark-zju%2Fgitrevset/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quark-zju%2Fgitrevset/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/quark-zju","download_url":"https://codeload.github.com/quark-zju/gitrevset/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250882637,"owners_count":21502341,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","revset"],"created_at":"2024-08-04T08:02:02.334Z","updated_at":"2025-04-25T19:32:12.971Z","avatar_url":"https://github.com/quark-zju.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# gitrevset\n\n[![Documentation](https://docs.rs/gitrevset/badge.svg)](https://docs.rs/gitrevset)\n![Build Status](https://github.com/quark-zju/gitrevset/workflows/build/badge.svg)\n\nA domain-specific-language to select commits in a git repo. Similar to\n[Mercurial's revset](https://www.mercurial-scm.org/repo/hg/help/revsets).\n\nSee [the crate documentation](https://docs.rs/gitrevset/#language-specification) for supported functions and operators. More functions might be added over time.\n\n`gitrevset` provides the Rust library interface. There is also a simple command-line utility `git-revs`. It takes revset expressions as arguments, and outputs commit hashes.\n\n## Examples\n\n### Revset Expressions\n\nThe current commit (HEAD) and its parent:\n\n    . + .^\n\nMerge base (common ancestor) of HEAD and origin/master:\n\n    gca(., origin/master)\n\nThe bottom of the current local (draft) branch:\n\n    roots(draft() \u0026 ::.)\n\nTagged commits since 100 days ago:\n\n    tag() \u0026 date(\"since 100 days ago\")\n\nCommits by \"alice\" or \"bob\" in the \"dev\" but not \"master\" branch:\n\n    (dev % master) \u0026 (author(alice) | author(bob))\n\n### Using `gitrevset` Library\n\nParse revset from a string at runtime. Execute it and iterate through the `Oid`s:\n\n```rust\nuse gitrevset::{Repo, SetExt};\n\nlet repo = Repo::open_from_env()?;\nlet set = repo.revs(\"(draft() \u0026 ::.)^ + .\")?;\nfor oid in set.to_oids()? {\n    dbg!(oid?)\n}\n```\n\nParse at compile time. Interact with local variables like strings, or calculated set:\n\n```rust\nuse gitrevset::{ast, Repo};\n\nlet repo = Repo::open_from_env()?;\nlet master = \"origin/master\";\nlet stack = repo.revs(ast!(only(\".\", ref({ master }))))?;\nlet head = repo.revs(ast!(heads({ stack })))?;\n```\n\n### Using `git-revs` CLI\n\n```bash\ngit revs \"(draft() \u0026 ::.)^ + .\"\n```\n\n### Configuration\n\nCustomized revset aliases or functions can be defined in git config:\n\n```ini\n[revsetalias]\nd = draft()\nf = ancestor($1, origin/master):$1\n```\n\nThen they can be used in `git-revs` or using the `repo.anyrevs` API.\n\n```bash\ngit revs \"f(d)\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquark-zju%2Fgitrevset","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquark-zju%2Fgitrevset","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquark-zju%2Fgitrevset/lists"}