Git conundrum trying to backport stuff to mock backport

Tried to post this to python-dev, but that seems to have gone who-knows-where:

I’m in the process of bringing the mock backport up to date, but this has got me stumped:

$ git log --oneline --no-merges 5943ea76d529f9ea18c73a61e10c6f53bdcc864f… – Lib/unittest/mock.py Lib/unittest/test/testmock/ | tail
362f058a89 Issue #28735: Fixed the comparison of mock.MagickMock with mock.ANY.
d9c956fb23 Issue #20804: The unittest.mock.sentinel attributes now preserve their identity when they are copied or pickled.
84b6fb0eea Fix unittest.mock._Call: don’t ignore name
161a4dd495 Issue #28919: Simplify _copy_func_details() in unittest.mock
ac5084b6c7 Fixes issue28380: unittest.mock Mock autospec functions now properly support assert_called, assert_not_called, and assert_called_once.
0be894b2f6 Issue #27895: Spelling fixes (Contributed by Ville Skyttä).
15f44ab043 Issue #27895: Spelling fixes (Contributed by Ville Skyttä).
d4583d7fea Issue #26750: use inspect.isdatadescriptor instead of our own _is_data_descriptor().
9854789efe Issue #26750: unittest.mock.create_autospec() now works properly for subclasses of property() and other data descriptors.
204bf0b9ae English spelling and grammar fixes

Right, so I’ve merged up to 15f44ab043, what comes next?

$ git log --oneline --no-merges 15f44ab043… – Lib/unittest/mock.py Lib/unittest/test/testmock/ | tail -n 3
161a4dd495 Issue #28919: Simplify _copy_func_details() in unittest.mock
ac5084b6c7 Fixes issue28380: unittest.mock Mock autospec functions now properly support assert_called, assert_not_called, and assert_called_once.
0be894b2f6 Issue #27895: Spelling fixes (Contributed by Ville Skyttä).

Okay, no idea why 0be894b2f6 is there, appears to be a totally identical commit to 15f44ab043, so let’s skip it:

$ git log --oneline --no-merges 0be894b2f6… – Lib/unittest/mock.py Lib/unittest/test/testmock/ | tail -n 3
161a4dd495 Issue #28919: Simplify _copy_func_details() in unittest.mock
ac5084b6c7 Fixes issue28380: unittest.mock Mock autospec functions now properly support assert_called, assert_not_called, and assert_called_once.
15f44ab043 Issue #27895: Spelling fixes (Contributed by Ville Skyttä).

Wat?! Why is 15f44ab043 showing up again?!

What’s the git subtlety I’m missing here?

I have gotten answers to such questions by posting to core-mentorship list, even though already a core dev.

Hi Chris,

This is because our git history isn’t linear. Back in 2016 when these commits were made, I don’t believe we were keeping branches as separate and linear as we are now. However, since you’re showing the log without merge commits or any indication of relation between commits, it’s impossible to see the “shape” of the history graph.

For example, the two identical “Spelling fixes” commits (which you referenced when writing “no idea why 0be894b2f6 is there”) were done on separate branches, which were later merged.

Here’s a nice visualization from PyCharm’s history view:

It should also be possible to get git log to show similar output, or use other GUI tools e.g. gitk.

1 Like

Just to follow up: this is all long resolved, no need for more followup, thanks :slight_smile: