git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* I just want the revision
@ 2021-10-11  2:37 ToddAndMargo
  2021-10-11  9:45 ` Christian Couder
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: ToddAndMargo @ 2021-10-11  2:37 UTC (permalink / raw)
  To: git

Hi All,

I am trying to write a script to tell me the latest revision
showing on

https://gitlab.freedesktop.org/spice/win32/spice-nsis/-/tree/master

which is 'virtio-win: rebase on 0.164", but I can only see this
from a web browser, as the page is dynamic.

I do have access to the git link on that page:

https://gitlab.freedesktop.org/spice/win32/spice-nsis.git

Does git (or some other) have a way of telling me
JUST the revision without having to download the turkey?

If I could get something that contained
        virtio-win: rebase on 0.164
I could dig out the revision

Many thanks,
-T




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: I just want the revision
  2021-10-11  2:37 I just want the revision ToddAndMargo
@ 2021-10-11  9:45 ` Christian Couder
  2021-10-11 10:09   ` ToddAndMargo
  2021-10-11 16:18 ` Jeff King
  2021-10-12  1:03 ` ToddAndMargo
  2 siblings, 1 reply; 10+ messages in thread
From: Christian Couder @ 2021-10-11  9:45 UTC (permalink / raw)
  To: ToddAndMargo; +Cc: git

Hi,

On Mon, Oct 11, 2021 at 4:57 AM ToddAndMargo <ToddAndMargo@zoho.com> wrote:
>
> Hi All,
>
> I am trying to write a script to tell me the latest revision
> showing on
>
> https://gitlab.freedesktop.org/spice/win32/spice-nsis/-/tree/master
>
> which is 'virtio-win: rebase on 0.164", but I can only see this
> from a web browser, as the page is dynamic.
>
> I do have access to the git link on that page:
>
> https://gitlab.freedesktop.org/spice/win32/spice-nsis.git
>
> Does git (or some other) have a way of telling me
> JUST the revision without having to download the turkey?

If you just want the commit ID, you can use for example:

$ git ls-remote
https://gitlab.freedesktop.org/spice/win32/spice-nsis.git
refs/heads/master
f6ad44f35f5caeec51b7002169977272d85701a3        refs/heads/master

> If I could get something that contained
>         virtio-win: rebase on 0.164
> I could dig out the revision

You might also want to take a look at the GitLab API docs, for example:

https://docs.gitlab.com/ee/api/commits.html

Best,
Christian.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: I just want the revision
  2021-10-11  9:45 ` Christian Couder
@ 2021-10-11 10:09   ` ToddAndMargo
  2021-10-11 10:24     ` ToddAndMargo
  2021-10-11 16:02     ` Daniel Knittl-Frank
  0 siblings, 2 replies; 10+ messages in thread
From: ToddAndMargo @ 2021-10-11 10:09 UTC (permalink / raw)
  To: git; +Cc: Christian Couder

On 10/11/21 02:45, Christian Couder wrote:
> Hi,
> 
> On Mon, Oct 11, 2021 at 4:57 AM ToddAndMargo <ToddAndMargo@zoho.com> wrote:
>>
>> Hi All,
>>
>> I am trying to write a script to tell me the latest revision
>> showing on
>>
>> https://gitlab.freedesktop.org/spice/win32/spice-nsis/-/tree/master
>>
>> which is 'virtio-win: rebase on 0.164", but I can only see this
>> from a web browser, as the page is dynamic.
>>
>> I do have access to the git link on that page:
>>
>> https://gitlab.freedesktop.org/spice/win32/spice-nsis.git
>>
>> Does git (or some other) have a way of telling me
>> JUST the revision without having to download the turkey?
> 
> If you just want the commit ID, you can use for example:
> 
> $ git ls-remote
> https://gitlab.freedesktop.org/spice/win32/spice-nsis.git
> refs/heads/master
> f6ad44f35f5caeec51b7002169977272d85701a3        refs/heads/master
> 
>> If I could get something that contained
>>          virtio-win: rebase on 0.164
>> I could dig out the revision
> 
> You might also want to take a look at the GitLab API docs, for example:
> 
> https://docs.gitlab.com/ee/api/commits.html
> 
> Best,
> Christian.
> 

Hi Christian,

I do not mean to be dense, but how do I get
"virtio-win: rebase on 0.164" out of:
" f6ad44f35f5caeec51b7002169977272d85701a3  refs/heads/master"?

Perplexed,
-T

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: I just want the revision
  2021-10-11 10:09   ` ToddAndMargo
@ 2021-10-11 10:24     ` ToddAndMargo
  2021-10-11 13:13       ` Christian Couder
  2021-10-11 16:02     ` Daniel Knittl-Frank
  1 sibling, 1 reply; 10+ messages in thread
From: ToddAndMargo @ 2021-10-11 10:24 UTC (permalink / raw)
  To: git; +Cc: Christian Couder

On 10/11/21 03:09, ToddAndMargo wrote:
> On 10/11/21 02:45, Christian Couder wrote:
>> Hi,
>>
>> On Mon, Oct 11, 2021 at 4:57 AM ToddAndMargo <ToddAndMargo@zoho.com> 
>> wrote:
>>>
>>> Hi All,
>>>
>>> I am trying to write a script to tell me the latest revision
>>> showing on
>>>
>>> https://gitlab.freedesktop.org/spice/win32/spice-nsis/-/tree/master
>>>
>>> which is 'virtio-win: rebase on 0.164", but I can only see this
>>> from a web browser, as the page is dynamic.
>>>
>>> I do have access to the git link on that page:
>>>
>>> https://gitlab.freedesktop.org/spice/win32/spice-nsis.git
>>>
>>> Does git (or some other) have a way of telling me
>>> JUST the revision without having to download the turkey?
>>
>> If you just want the commit ID, you can use for example:
>>
>> $ git ls-remote
>> https://gitlab.freedesktop.org/spice/win32/spice-nsis.git
>> refs/heads/master
>> f6ad44f35f5caeec51b7002169977272d85701a3        refs/heads/master
>>
>>> If I could get something that contained
>>>          virtio-win: rebase on 0.164
>>> I could dig out the revision
>>
>> You might also want to take a look at the GitLab API docs, for example:
>>
>> https://docs.gitlab.com/ee/api/commits.html
>>
>> Best,
>> Christian.
>>
> 
> Hi Christian,
> 
> I do not mean to be dense, but how do I get
> "virtio-win: rebase on 0.164" out of:
> " f6ad44f35f5caeec51b7002169977272d85701a3  refs/heads/master"?
> 
> Perplexed,
> -T


Found something that worked:

$ curl --silent 
'https://gitlab.freedesktop.org/spice/win32/spice-nsis/-/commits/master' 
| grep  rebase

<a class="commit-row-message item-title js-onboarding-commit-item " 
href="/spice/win32/spice-nsis/-/commit/f6ad44f35f5caeec51b7002169977272d85701a3">virtio-win: 
rebase on 0.164</a>

<a class="commit-row-message item-title js-onboarding-commit-item " 
href="/spice/win32/spice-nsis/-/commit/d6836f79ba8deeef5b7719fd94cc208b81eb70df">virtio-win: 
rebase on 0.164</a>



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: I just want the revision
  2021-10-11 10:24     ` ToddAndMargo
@ 2021-10-11 13:13       ` Christian Couder
  2021-10-11 21:51         ` ToddAndMargo
  0 siblings, 1 reply; 10+ messages in thread
From: Christian Couder @ 2021-10-11 13:13 UTC (permalink / raw)
  To: ToddAndMargo; +Cc: git

On Mon, Oct 11, 2021 at 12:24 PM ToddAndMargo <ToddAndMargo@zoho.com> wrote:
>
> On 10/11/21 03:09, ToddAndMargo wrote:
> > On 10/11/21 02:45, Christian Couder wrote:
> >> Hi,
> >>
> >> On Mon, Oct 11, 2021 at 4:57 AM ToddAndMargo <ToddAndMargo@zoho.com>
> >> wrote:
> >>>
> >>> Hi All,
> >>>
> >>> I am trying to write a script to tell me the latest revision
> >>> showing on
> >>>
> >>> https://gitlab.freedesktop.org/spice/win32/spice-nsis/-/tree/master
> >>>
> >>> which is 'virtio-win: rebase on 0.164", but I can only see this
> >>> from a web browser, as the page is dynamic.
> >>>
> >>> I do have access to the git link on that page:
> >>>
> >>> https://gitlab.freedesktop.org/spice/win32/spice-nsis.git
> >>>
> >>> Does git (or some other) have a way of telling me
> >>> JUST the revision without having to download the turkey?
> >>
> >> If you just want the commit ID, you can use for example:
> >>
> >> $ git ls-remote
> >> https://gitlab.freedesktop.org/spice/win32/spice-nsis.git
> >> refs/heads/master
> >> f6ad44f35f5caeec51b7002169977272d85701a3        refs/heads/master
> >>
> >>> If I could get something that contained
> >>>          virtio-win: rebase on 0.164
> >>> I could dig out the revision
> >>
> >> You might also want to take a look at the GitLab API docs, for example:
> >>
> >> https://docs.gitlab.com/ee/api/commits.html
> >>
> >> Best,
> >> Christian.
> >>
> >
> > Hi Christian,
> >
> > I do not mean to be dense, but how do I get
> > "virtio-win: rebase on 0.164" out of:
> > " f6ad44f35f5caeec51b7002169977272d85701a3  refs/heads/master"?
> >
> > Perplexed,
> > -T
>
>
> Found something that worked:
>
> $ curl --silent
> 'https://gitlab.freedesktop.org/spice/win32/spice-nsis/-/commits/master'
> | grep  rebase
>
> <a class="commit-row-message item-title js-onboarding-commit-item "
> href="/spice/win32/spice-nsis/-/commit/f6ad44f35f5caeec51b7002169977272d85701a3">virtio-win:
> rebase on 0.164</a>
>
> <a class="commit-row-message item-title js-onboarding-commit-item "
> href="/spice/win32/spice-nsis/-/commit/d6836f79ba8deeef5b7719fd94cc208b81eb70df">virtio-win:
> rebase on 0.164</a>

If I needed more information than just the commit ID, I would use the
GitLab API, especially:

https://docs.gitlab.com/ee/api/commits.html#get-a-single-commit

So you might want to customize this example command:

$ curl --header "PRIVATE-TOKEN: <your_access_token>"
"https://gitlab.example.com/api/v4/projects/5/repository/commits/master"

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: I just want the revision
  2021-10-11 10:09   ` ToddAndMargo
  2021-10-11 10:24     ` ToddAndMargo
@ 2021-10-11 16:02     ` Daniel Knittl-Frank
  1 sibling, 0 replies; 10+ messages in thread
From: Daniel Knittl-Frank @ 2021-10-11 16:02 UTC (permalink / raw)
  To: ToddAndMargo; +Cc: git, Christian Couder

That seems to be the commit subject. One simple way would be to use
git log in a clone of the repo:

    git log -1 --pretty=format:%s origin/master

You can also use git cat-file to get a bit more output (commit id,
tree id, author and committer info, full commit message):

    git cat-file -p origin/master

HTH
Daniel


On Mon, Oct 11, 2021 at 12:09 PM ToddAndMargo <ToddAndMargo@zoho.com> wrote:
>
> On 10/11/21 02:45, Christian Couder wrote:
> > Hi,
> >
> > On Mon, Oct 11, 2021 at 4:57 AM ToddAndMargo <ToddAndMargo@zoho.com> wrote:
> >>
> >> Hi All,
> >>
> >> I am trying to write a script to tell me the latest revision
> >> showing on
> >>
> >> https://gitlab.freedesktop.org/spice/win32/spice-nsis/-/tree/master
> >>
> >> which is 'virtio-win: rebase on 0.164", but I can only see this
> >> from a web browser, as the page is dynamic.
> >>
> >> I do have access to the git link on that page:
> >>
> >> https://gitlab.freedesktop.org/spice/win32/spice-nsis.git
> >>
> >> Does git (or some other) have a way of telling me
> >> JUST the revision without having to download the turkey?
> >
> > If you just want the commit ID, you can use for example:
> >
> > $ git ls-remote
> > https://gitlab.freedesktop.org/spice/win32/spice-nsis.git
> > refs/heads/master
> > f6ad44f35f5caeec51b7002169977272d85701a3        refs/heads/master
> >
> >> If I could get something that contained
> >>          virtio-win: rebase on 0.164
> >> I could dig out the revision
> >
> > You might also want to take a look at the GitLab API docs, for example:
> >
> > https://docs.gitlab.com/ee/api/commits.html
> >
> > Best,
> > Christian.
> >
>
> Hi Christian,
>
> I do not mean to be dense, but how do I get
> "virtio-win: rebase on 0.164" out of:
> " f6ad44f35f5caeec51b7002169977272d85701a3  refs/heads/master"?
>
> Perplexed,
> -T



-- 
typed with http://neo-layout.org

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: I just want the revision
  2021-10-11  2:37 I just want the revision ToddAndMargo
  2021-10-11  9:45 ` Christian Couder
@ 2021-10-11 16:18 ` Jeff King
  2021-10-12  1:03 ` ToddAndMargo
  2 siblings, 0 replies; 10+ messages in thread
From: Jeff King @ 2021-10-11 16:18 UTC (permalink / raw)
  To: ToddAndMargo; +Cc: git

On Sun, Oct 10, 2021 at 07:37:12PM -0700, ToddAndMargo wrote:

> I am trying to write a script to tell me the latest revision
> showing on
> 
> https://gitlab.freedesktop.org/spice/win32/spice-nsis/-/tree/master
> 
> which is 'virtio-win: rebase on 0.164", but I can only see this
> from a web browser, as the page is dynamic.
> 
> I do have access to the git link on that page:
> 
> https://gitlab.freedesktop.org/spice/win32/spice-nsis.git
> 
> Does git (or some other) have a way of telling me
> JUST the revision without having to download the turkey?

I'd probably use an API provided by the hosting service in this case, as
Christian recommended, since it will be the most efficient route. But
just for the sake of completeness, if you wanted to limit yourself only
to Git commands, you could make a partial shallow clone of a single
branch like this:

  git clone --bare --depth 1 --filter=tree:0 \
	https://gitlab.freedesktop.org/spice/win32/spice-nsis.git
  cd spice-nsis.git
  git log -1 --format=%s

That should fetch only a single object. You only get the HEAD branch
because --depth implies --single-branch. You can use "clone -b" to get a
different branch if you want.

-Peff

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: I just want the revision
  2021-10-11 13:13       ` Christian Couder
@ 2021-10-11 21:51         ` ToddAndMargo
  2021-10-11 22:43           ` Christian Couder
  0 siblings, 1 reply; 10+ messages in thread
From: ToddAndMargo @ 2021-10-11 21:51 UTC (permalink / raw)
  To: Christian Couder; +Cc: git

On 10/11/21 06:13, Christian Couder wrote:
> On Mon, Oct 11, 2021 at 12:24 PM ToddAndMargo <ToddAndMargo@zoho.com> wrote:
>>
>> On 10/11/21 03:09, ToddAndMargo wrote:
>>> On 10/11/21 02:45, Christian Couder wrote:
>>>> Hi,
>>>>
>>>> On Mon, Oct 11, 2021 at 4:57 AM ToddAndMargo <ToddAndMargo@zoho.com>
>>>> wrote:
>>>>>
>>>>> Hi All,
>>>>>
>>>>> I am trying to write a script to tell me the latest revision
>>>>> showing on
>>>>>
>>>>> https://gitlab.freedesktop.org/spice/win32/spice-nsis/-/tree/master
>>>>>
>>>>> which is 'virtio-win: rebase on 0.164", but I can only see this
>>>>> from a web browser, as the page is dynamic.
>>>>>
>>>>> I do have access to the git link on that page:
>>>>>
>>>>> https://gitlab.freedesktop.org/spice/win32/spice-nsis.git
>>>>>
>>>>> Does git (or some other) have a way of telling me
>>>>> JUST the revision without having to download the turkey?
>>>>
>>>> If you just want the commit ID, you can use for example:
>>>>
>>>> $ git ls-remote
>>>> https://gitlab.freedesktop.org/spice/win32/spice-nsis.git
>>>> refs/heads/master
>>>> f6ad44f35f5caeec51b7002169977272d85701a3        refs/heads/master
>>>>
>>>>> If I could get something that contained
>>>>>           virtio-win: rebase on 0.164
>>>>> I could dig out the revision
>>>>
>>>> You might also want to take a look at the GitLab API docs, for example:
>>>>
>>>> https://docs.gitlab.com/ee/api/commits.html
>>>>
>>>> Best,
>>>> Christian.
>>>>
>>>
>>> Hi Christian,
>>>
>>> I do not mean to be dense, but how do I get
>>> "virtio-win: rebase on 0.164" out of:
>>> " f6ad44f35f5caeec51b7002169977272d85701a3  refs/heads/master"?
>>>
>>> Perplexed,
>>> -T
>>
>>
>> Found something that worked:
>>
>> $ curl --silent
>> 'https://gitlab.freedesktop.org/spice/win32/spice-nsis/-/commits/master'
>> | grep  rebase
>>
>> <a class="commit-row-message item-title js-onboarding-commit-item "
>> href="/spice/win32/spice-nsis/-/commit/f6ad44f35f5caeec51b7002169977272d85701a3">virtio-win:
>> rebase on 0.164</a>
>>
>> <a class="commit-row-message item-title js-onboarding-commit-item "
>> href="/spice/win32/spice-nsis/-/commit/d6836f79ba8deeef5b7719fd94cc208b81eb70df">virtio-win:
>> rebase on 0.164</a>
> 
> If I needed more information than just the commit ID, I would use the
> GitLab API, especially:
> 
> https://docs.gitlab.com/ee/api/commits.html#get-a-single-commit
> 
> So you might want to customize this example command:
> 
> $ curl --header "PRIVATE-TOKEN: <your_access_token>"
> "https://gitlab.example.com/api/v4/projects/5/repository/commits/master"
> 

no idea what the " <your_access_token>" is.

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Computers are like air conditioners.
They malfunction when you open windows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: I just want the revision
  2021-10-11 21:51         ` ToddAndMargo
@ 2021-10-11 22:43           ` Christian Couder
  0 siblings, 0 replies; 10+ messages in thread
From: Christian Couder @ 2021-10-11 22:43 UTC (permalink / raw)
  To: ToddAndMargo; +Cc: git

On Mon, Oct 11, 2021 at 11:52 PM ToddAndMargo <ToddAndMargo@zoho.com> wrote:
>
> On 10/11/21 06:13, Christian Couder wrote:

> > If I needed more information than just the commit ID, I would use the
> > GitLab API, especially:
> >
> > https://docs.gitlab.com/ee/api/commits.html#get-a-single-commit
> >
> > So you might want to customize this example command:
> >
> > $ curl --header "PRIVATE-TOKEN: <your_access_token>"
> > "https://gitlab.example.com/api/v4/projects/5/repository/commits/master"
> >
>
> no idea what the " <your_access_token>" is.

This is a mailing list about Git, not GitLab or other service
providers, so I don't want to go into too many details here. As I
already explained you should look at the docs for more details.
Alternatively you can google it or ask in a GitLab forum or to GitLab
support if you have paid for that.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: I just want the revision
  2021-10-11  2:37 I just want the revision ToddAndMargo
  2021-10-11  9:45 ` Christian Couder
  2021-10-11 16:18 ` Jeff King
@ 2021-10-12  1:03 ` ToddAndMargo
  2 siblings, 0 replies; 10+ messages in thread
From: ToddAndMargo @ 2021-10-12  1:03 UTC (permalink / raw)
  To: git

On 10/10/21 19:37, ToddAndMargo wrote:
> Hi All,
> 
> I am trying to write a script to tell me the latest revision
> showing on
> 
> https://gitlab.freedesktop.org/spice/win32/spice-nsis/-/tree/master
> 
> which is 'virtio-win: rebase on 0.164", but I can only see this
> from a web browser, as the page is dynamic.
> 
> I do have access to the git link on that page:
> 
> https://gitlab.freedesktop.org/spice/win32/spice-nsis.git
> 
> Does git (or some other) have a way of telling me
> JUST the revision without having to download the turkey?
> 
> If I could get something that contained
>         virtio-win: rebase on 0.164
> I could dig out the revision
> 
> Many thanks,
> -T

This simulates what I came up with in my actual code:

$ curl --silent 
'https://gitlab.freedesktop.org/spice/win32/spice-nsis/-/commits/master' 
| raku -ne 'my Str $x=slurp(); $x~~s/.*? "rebase on " //; $x~~s/ 
("</a>") .* //; print "$x\n";'

0.164


Thank you all for the tips!

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-10-12  1:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-11  2:37 I just want the revision ToddAndMargo
2021-10-11  9:45 ` Christian Couder
2021-10-11 10:09   ` ToddAndMargo
2021-10-11 10:24     ` ToddAndMargo
2021-10-11 13:13       ` Christian Couder
2021-10-11 21:51         ` ToddAndMargo
2021-10-11 22:43           ` Christian Couder
2021-10-11 16:02     ` Daniel Knittl-Frank
2021-10-11 16:18 ` Jeff King
2021-10-12  1:03 ` ToddAndMargo

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).