[Python-Dev] Questions on the CPython Git master branch: how to exclude commits of 3.x branches?

Mariatta Wijaya mariatta.wijaya at gmail.com
Fri Mar 31 11:56:12 EDT 2017


Can you try

git log master ^3.6

I think it will give what's on master and not in 3.6



On Mar 31, 2017 8:47 AM, "Victor Stinner" <victor.stinner at gmail.com> wrote:

> Hi,
>
> The CPython repository was converted from Mercurial to Git. Before
> with Mercurial, we used extensively merges. For example, a bug was
> fixed in branche 3.5, merged into 3.6 and then merged into master.
> With the conversion to Git, some merges commit are removed, some
> others are kept.
>
> My question is how to list commits which are only part of the "master"
> branch, as "hg log default" in Mercurial. "git log origin/master"
> lists also commits coming from 3.x branches and their merges. The
> problem is that if you pick a commit from a different branch, you
> compile Python 3.x, instead of compiling Python for the master branch.
>
> Right now, my need is to find the first commit in the "master" branch
> after a specific date. For example, find the first commit after
> 2016-01-01 00:00.
>
> Naive solution:
> ---
> $ git log --since="2016-01-01 00:00" origin/master --reverse|head
> commit 75e3630c6071819d3674d956ea754ccb4fed5271
> Author: Benjamin Peterson <benjamin at python.org>
> Date:   Fri Jan 1 10:23:45 2016 -0600
>
>     2016 will be another year of writing copyrighted code
> ---
>
> If you compile the revision 75e3630c6071819d3674d956ea754ccb4fed5271,
> you get Python 3.3:
> ---
> $ grep PY_M Include/patchlevel.h
> #define PY_MAJOR_VERSION    3
> #define PY_MINOR_VERSION    3
> #define PY_MICRO_VERSION    6
> ---
>
> But if you exclude manually commits which are in branches 3.x, you get
> the commit 71db903563906cedfc098418659d1200043cd14c which gives a
> different Python version:
> ---
> $ grep PY_M Include/patchlevel.h
> #define PY_MAJOR_VERSION    3
> #define PY_MINOR_VERSION    6
> #define PY_MICRO_VERSION    0
> ---
>
> In fact, I wrote a tool to manually exclude commits of branches 3.x:
>
> https://github.com/haypo/misc/blob/master/misc/find_git_
> revisions_by_date.py
>
> But it's super slow! Are there builtin options to only show Git
> commits which are in master branch but not in 3.x branches?
>
> Asked differently: how can I only see two commits on the following
> range? What are [options]?
>
> git rev-list 288cb25f1a208fe09b9e06ba479e11c1157da4b5..
> 71db903563906cedfc098418659d1200043cd14c
> [options]
>
> Commits after 2016-01-01:
> ---
> $ git checkout 71db903563906cedfc098418659d1200043cd14c
> $ git log --graph
> *   commit 71db903563906cedfc098418659d1200043cd14c
> |\  Merge: 288cb25 4c70293
> | | Author: Benjamin Peterson <benjamin at python.org>
> | | Date:   Fri Jan 1 10:25:22 2016 -0600
> | |
> | |     merge 3.5
> | |
> | *   commit 4c70293755ce8ea0adc5b224c714da2b7625d232
> | |\  Merge: 42bf8fc e8c2a95
> | | | Author: Benjamin Peterson <benjamin at python.org>
> | | | Date:   Fri Jan 1 10:25:12 2016 -0600
> | | |
> | | |     merge 3.4
> | | |
> | | *   commit e8c2a957c87980a1fd79c39597d40e5c5aeb7048
> | | |\  Merge: 52d6c2c 75e3630
> | | | | Author: Benjamin Peterson <benjamin at python.org>
> | | | | Date:   Fri Jan 1 10:24:21 2016 -0600
> | | | |
> | | | |     merge 3.3
> | | | |
> | | | * commit 75e3630c6071819d3674d956ea754ccb4fed5271
> | | | | Author: Benjamin Peterson <benjamin at python.org>
> | | | | Date:   Fri Jan 1 10:23:45 2016 -0600
> | | | |
> | | | |     2016 will be another year of writing copyrighted code
> | | | |
> * | | |   commit 288cb25f1a208fe09b9e06ba479e11c1157da4b5
> |\ \ \ \  Merge: 58f8833 42bf8fc
> | |/ / /  Author: Serhiy Storchaka <storchaka at gmail.com>
> | | | |   Date:   Wed Dec 30 21:41:53 2015 +0200
> | | | |
> | | | |       Issue #25961: Disallowed null characters in the type name.
> | | | |       Simplified testing for null characters in __name__ setter.
> | | | |
> ---
>
> Victor
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> mariatta.wijaya%40gmail.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20170331/f63b0e2d/attachment.html>


More information about the Python-Dev mailing list