Github questions

General discussion and chat (archived)
Fedor2

Github questions

Unread post by Fedor2 » 2017-03-30, 03:39

I want extract commits for one certain date, to apply them in the code, i read github help but not found a clue how to do this.
Is it possible?

adisib
Lunatic
Lunatic
Posts: 380
Joined: 2015-06-13, 03:34
Location: KY

Re: Github questions

Unread post by adisib » 2017-03-30, 04:31

I don't think it is possible from the Github UI. But you can do it on a local copy of the repository on your computer if you have git installed.

The first thing that would come to mind for me would be something like (use %ad instead of %cd if you want the author date instead of the commit date):

Code: Select all

git log --pretty=format:"%h - %cd" | grep "Mar 16 .* 2017"
Which would return something like:

Code: Select all

ac8e1ef - Thu Mar 16 19:27:33 2017 -0400
f998c78 - Thu Mar 16 19:24:50 2017 -0400
e8ec8a5 - Thu Mar 16 19:15:52 2017 -0400
This gives you the commits for that particular day (March 16 2017 in that example), if you have cloned the repository and run the commands for your local version. You would need grep for this. There's likely to be a much better way, but it isn't coming up off the top of my head.

-----

Edit:
Decided to look on man pages to see if there was an much easier way.

You could do something similar to the above in a much better way with this (note this is author date, not commit date) and you don't need to have grep:

Code: Select all

git log --since="2017-3-15" --until="2017-3-17" --oneline
This will output:

Code: Select all

ac8e1ef [Commit message]
f998c78 [Commit message]
e8ec8a5 [Commit message]

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35474
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Github questions

Unread post by Moonchild » 2017-03-30, 08:45

Managing commits in GitHub is very limited. You should probably use a graphical git client like SourceTree for convenience when trying to cherry-pick commits.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

Fedor2

Re: Github questions

Unread post by Fedor2 » 2017-04-04, 17:42

Still failed to do what i want

First i do

Code: Select all

..\bin\git log --since="2016-12-15" --until="2017-1-10" --patch > p111222 
It produces a file, seems valid.
Then

Code: Select all

..\bin\git checkout 27.0_RelBranch
It also executes normally
And finally

Code: Select all

..\bin\git apply p111222
Has bunch of errors
error: patch failed: toolkit/jetpack/moz.build:163
error: toolkit/jetpack/moz.build: patch does not apply
error: patch failed: toolkit/jetpack/moz.build:161
error: toolkit/jetpack/moz.build: patch does not apply
error: dom/media/platforms/ffmpeg/FFmpegFunctionList.h: No such file or director
y
error: dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp: No such file or direc
tory
error: dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.h: No such file or directo
ry
error: dom/media/platforms/ffmpeg/FFmpegFunctionList.h: No such file or director
y
error: dom/media/platforms/ffmpeg/FFmpegLibs.h: No such file or directory
error: dom/media/platforms/ffmpeg/libav53/include/libavformat/avformat.h: No suc
h file or directory
error: dom/media/platforms/ffmpeg/libav53/include/libavformat/avio.h: No such fi
le or directory
error: dom/media/platforms/ffmpeg/libav53/include/libavformat/version.h: No such
file or directory
error: dom/media/platforms/ffmpeg/libav54/include/libavformat/avformat.h: No suc
h file or directory
error: dom/media/platforms/ffmpeg/libav54/include/libavformat/avio.h: No such fi
le or directory
error: dom/media/platforms/ffmpeg/libav54/include/libavformat/version.h: No such
file or directory
error: dom/media/platforms/ffmpeg/libav55/include/libavformat/avformat.h: No suc
h file or directory
error: dom/media/platforms/ffmpeg/libav55/include/libavformat/avio.h: No such fi
le or directory
error: dom/media/platforms/ffmpeg/libav55/include/libavformat/version.h: No such
file or directory
error: dom/media/platforms/ffmpeg/FFmpegAudioDecoder.cpp: No such file or direct
What i do wrong?

adisib
Lunatic
Lunatic
Posts: 380
Joined: 2015-06-13, 03:34
Location: KY

Re: Github questions

Unread post by adisib » 2017-04-04, 18:59

Try using format-patch:

Code: Select all

git format-patch C1..C2
git checkout 27.0_RelBranch
git am *.patch
where C1 is the first commit hash that you want to add, and C2 is the last.

New Tobin Paradigm

Re: Github questions

Unread post by New Tobin Paradigm » 2017-04-04, 18:59

See: viewtopic.php?f=29&t=15014&p=108551#p108551

This explains the basic overview of Pale Moon development.. You should be able to gleam your answer from it. If not.. Someone else can explain.

Fedor2

Re: Github questions

Unread post by Fedor2 » 2017-04-11, 06:08

adisib
No way, if c1 c2 commit numbers like c93fb24 , format-patch produses a bunch of files but no c93fb24, git am is something to do with mail and errors about *.patch. Tried different format-patch options, stood for nothing the git manual.
Oh dear how it so obscure. why???

So how to do if only one commit c93fb24?

_ntnn

Re: Github questions

Unread post by _ntnn » 2017-04-11, 11:46

Fedor2 wrote:adisib
No way, if c1 c2 commit numbers like c93fb24 , format-patch produses a bunch of files but no c93fb24
Yes, that is what format-patch is designed to do.
git am is something to do with mail and errors about *.patch.
git-am is used to apply patches attached to email, e.g. via git-send-email, to the local code base - not patch files.

To apply diffs (as generated by format-patch) to your local code base you'll have to use git-apply.

What adisib was explaining was that you could go two ways.
a) Generate patch files and apply them to your local tree (git-format-patch then git-apply)
b) Output the sha-sums with git-log and then git-cherry-pick them in your local tree.

Fedor2

Re: Github questions

Unread post by Fedor2 » 2017-04-19, 17:51

At last I can make git do desired patches.
But i stay very confused anyway. Like all commits are applied according to its list, but it seems is not, where to get its right sequence?

Example
https://github.com/MoonchildProductions ... f61ce3cadd
is located before the
https://github.com/MoonchildProductions ... 01400dc154
which is already applied inside 27.0_Relbranch. And it will errors about it.

filip

Re: Github questions

Unread post by filip » 2017-04-19, 19:34

@Fedor2:

As Moonchild said, "git cherry-pick" is your best friend here.
Since you haven't provided any details it's hard to be specific, so please tell us which commits, from which branch and where to are you trying to apply them ( onto which branch )!?

For the sake of example, I'll assume here that you want to apply some commit range onto master. If so:

1. First make sure that you localy have the branch you're picking from:

Code: Select all

git pull origin branch_name
2. Then make sure you're on the master (target) branch:

Code: Select all

git checkout master
3. Now cherry-pick:

Code: Select all

git cherry-pick C1..C2
:)

Fedor2

Re: Github questions

Unread post by Fedor2 » 2017-04-20, 02:19

I'm trying to apply commits after the 27.0_relbranch and before 27.1 on the 27.0_relbranch

I did as [/b]filip suggest, but without pull, i have already all branch, so i decided not do it.

Code: Select all

git checkout 27.0_relbranch
git cherry-pick 27.0_relbranch..8b3e92a
Got

Code: Select all

error: could not apply 79c8db4... Replace dom::TimeRanges with TimeIntervals object
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
This is even more confusing.


With format-patch method even if i can see which patch failed.

New Tobin Paradigm

Re: Github questions

Unread post by New Tobin Paradigm » 2017-04-20, 04:39

Use a GUI for gods sake and cherry pick only the commit you want.. Also, why do you need to cherry pick at all to an old relbranch.. That isn't how the branch structure is.. structured..

Fedor2

Re: Github questions

Unread post by Fedor2 » 2017-04-20, 06:04

The matter is not about chery-pick exactly, i was searching any means to make span between 27.0 and 27.1. Because something there breaks one particular site. I think about to apply commits sequentially beginning from 27.0_RelBranch.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35474
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Github questions

Unread post by Moonchild » 2017-04-20, 06:21

Why don't you just "checkout" the individual commits on the master branch that you want to look at?
that way you don't have to manually apply/pick anything, and you can bisect to quickly home in on the issue.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

Fedor2

Re: Github questions

Unread post by Fedor2 » 2017-04-20, 07:21

Oh thanks!
This is good idea, but...

Code: Select all

error: The following untracked working tree files would be overwritten by checkout:
        dom/media/platforms/ffmpeg/libav53/include/libavformat/avformat.h
        dom/media/platforms/ffmpeg/libav53/include/libavformat/avio.h
        dom/media/platforms/ffmpeg/libav53/include/libavformat/version.h
        dom/media/platforms/ffmpeg/libav54/include/libavformat/avformat.h
        dom/media/platforms/ffmpeg/libav54/include/libavformat/avio.h
        dom/media/platforms/ffmpeg/libav54/include/libavformat/version.h
        dom/media/platforms/ffmpeg/libav55/include/libavformat/avformat.h
        dom/media/platforms/ffmpeg/libav55/include/libavformat/avio.h
        dom/media/platforms/ffmpeg/libav55/include/libavformat/version.h
Please move or remove them before you can switch branches.
Aborting
Am i wrong, if i delete them? I already have deleted and checkout passed fine, but i worry.

New Tobin Paradigm

Re: Github questions

Unread post by New Tobin Paradigm » 2017-04-20, 07:29

If you are in doubt.. Delete the repository completely and re-clone.

Fedor2

Re: Github questions

Unread post by Fedor2 » 2017-06-26, 12:55

Another question.

What is the good way to update source code?
1. Download from the github and replace old code
2. Execute git fetch inside existing old code folder
3. Execute git pull inside existing old code folder
4. Delete older folder and execute git clone

JustOff

Re: Github questions

Unread post by JustOff » 2017-06-26, 13:06

Fetch does not update the code, you need to use pull. But as Tobin has already recommended above you better use GUI. My preferred is SourceTree.

Fedor2

Re: Github questions

Unread post by Fedor2 » 2017-06-26, 13:53

So git pull is right, shall do it then. And about gui you suggested - too bad, it wont start in winxp.
I do use git on occasion, gui likely not needed.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35474
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Github questions

Unread post by Moonchild » 2017-06-26, 14:15

I wouldn't recommend using Win XP as a development environment for anything the size of our code base. Besides, how do you think you are going to compile anything?
There are, by the way, several different GUIs for git available, all of them tons better than trying to do it from the command-line.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

Locked