Page 1 of 2

Github questions

Posted: Thu, 30 Mar 2017, 03:39
by Fedor2
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?

Re: Github questions

Posted: Thu, 30 Mar 2017, 04:31
by adisib
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]

Re: Github questions

Posted: Thu, 30 Mar 2017, 08:45
by Moonchild
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.

Re: Github questions

Posted: Tue, 04 Apr 2017, 17:42
by Fedor2
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?

Re: Github questions

Posted: Tue, 04 Apr 2017, 18:59
by adisib
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.

Re: Github questions

Posted: Tue, 04 Apr 2017, 18:59
by New Tobin Paradigm
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.

Re: Github questions

Posted: Tue, 11 Apr 2017, 06:08
by Fedor2
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?

Re: Github questions

Posted: Tue, 11 Apr 2017, 11:46
by _ntnn
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.

Re: Github questions

Posted: Wed, 19 Apr 2017, 17:51
by Fedor2
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.

Re: Github questions

Posted: Wed, 19 Apr 2017, 19:34
by filip
@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


:)

Re: Github questions

Posted: Thu, 20 Apr 2017, 02:19
by Fedor2
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[b] 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.

Re: Github questions

Posted: Thu, 20 Apr 2017, 04:39
by New Tobin Paradigm
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..

Re: Github questions

Posted: Thu, 20 Apr 2017, 06:04
by Fedor2
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.

Re: Github questions

Posted: Thu, 20 Apr 2017, 06:21
by Moonchild
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.

Re: Github questions

Posted: Thu, 20 Apr 2017, 07:21
by Fedor2
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.

Re: Github questions

Posted: Thu, 20 Apr 2017, 07:29
by New Tobin Paradigm
If you are in doubt.. Delete the repository completely and re-clone.

Re: Github questions

Posted: Mon, 26 Jun 2017, 12:55
by Fedor2
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

Re: Github questions

Posted: Mon, 26 Jun 2017, 13:06
by JustOff
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.

Re: Github questions

Posted: Mon, 26 Jun 2017, 13:53
by Fedor2
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.

Re: Github questions

Posted: Mon, 26 Jun 2017, 14:15
by Moonchild
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.