On Mar 31, 2017 10:48 AM, "Victor Stinner" <victor.stinner@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.

I think you want:

git log --no-merges --first-parent


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@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@python.org>
| | Date:   Fri Jan 1 10:25:22 2016 -0600
| |
| |     merge 3.5
| |
| *   commit 4c70293755ce8ea0adc5b224c714da2b7625d232
| |\  Merge: 42bf8fc e8c2a95
| | | Author: Benjamin Peterson <benjamin@python.org>
| | | Date:   Fri Jan 1 10:25:12 2016 -0600
| | |
| | |     merge 3.4
| | |
| | *   commit e8c2a957c87980a1fd79c39597d40e5c5aeb7048
| | |\  Merge: 52d6c2c 75e3630
| | | | Author: Benjamin Peterson <benjamin@python.org>
| | | | Date:   Fri Jan 1 10:24:21 2016 -0600
| | | |
| | | |     merge 3.3
| | | |
| | | * commit 75e3630c6071819d3674d956ea754ccb4fed5271
| | | | Author: Benjamin Peterson <benjamin@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@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@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: https://mail.python.org/mailman/options/python-dev/rymg19%40gmail.com


--
Ryan (ライアン)
Yoko Shimomura > ryo (supercell/EGOIST) > Hiroyuki Sawano >> everyone else
http://refi64.com