[Bug 5249] New: rebase created empty commit

mercurial-bugs at selenic.com mercurial-bugs at selenic.com
Wed May 25 18:33:31 EDT 2016


https://bz.mercurial-scm.org/show_bug.cgi?id=5249

            Bug ID: 5249
           Summary: rebase created empty commit
           Product: Mercurial
           Version: unspecified
          Hardware: PC
                OS: Windows
            Status: UNCONFIRMED
          Severity: bug
          Priority: wish
         Component: rebase
          Assignee: bugzilla at selenic.com
          Reporter: timeless at gmail.com
                CC: mercurial-devel at selenic.com

This commit has no content:
[timeless at gcc2-power8 crew]$ hg log --debug -pvr 33947
changeset:   33947:d2e76972ab86987b9b2120ba02750d1b65b7393a
topic:       runtests
phase:       draft
parent:      33946:3331b0f27af3aaa5caa2cde733570479c8720452
parent:      -1:0000000000000000000000000000000000000000
manifest:    33441:f4b7fade143938cd105daa4c12a03757fcded273
user:        timeless <timeless at mozdev.org>
date:        Fri May 06 19:15:37 2016 +0000
extra:       branch=default
extra:       rebase_source=e153363e62897362bab569db39de704469604698
extra:       topic=runtests
description:
tests: use print_function in test-archive.t



[timeless at gcc2-power8 crew]$

Note that both the commit's parent and the commit for which it's a parent have
the same topic, so this doesn't seem to be because of topics.

Rebase wasn't called with collapse (otherwise the commits would look rather
different) or keepbranches.

Offhand, I'm tempted to blame workingcommitctx

branch unchanged;
not close;
not merge;
cctx.files?
not allowemptycommit

localrepo.py:
    def commit(self, text="", user=None, date=None, match=None, force=False,
               editor=False, extra=None):
            cctx = context.workingcommitctx(self, status,
                                            text, user, date, extra)

            # internal config: ui.allowemptycommit
            allowemptycommit = (wctx.branch() != wctx.p1().branch()
                                or extra.get('close') or merge or cctx.files()
                                or self.ui.configbool('ui',
'allowemptycommit'))
            if not allowemptycommit:
                return None

rebase.py:
def concludenode(repo, rev, p1, p2, commitmsg=None, editor=None, extrafn=None,
                 keepbranches=False, date=None):
            newnode = repo.commit(text=commitmsg, user=ctx.user(),
                                  date=date, extra=extra, editor=editor)

def rebase(ui, repo, **opts):
                    newnode = concludenode(repo, rev, p1, p2, extrafn=extrafn,
                                           editor=editor,
                                           keepbranches=keepbranchesf,
                                           date=date)

                if newnode is not None:
                    state[rev] = repo[newnode].rev()
                    ui.debug('rebased as %s\n' % short(newnode))
                else:
                    if not collapsef:
                        ui.warn(_('note: rebase of %d:%s created no changes '
                                  'to commit\n') % (rev, ctx))

Fwiw, a series of these commits (33947::33949) impacted 0 files:
o  changeset:   33972:d847dcfda440
|  topic:       runtests
|  parent:      33949:8adee574f295
|  user:        timeless <timeless at mozdev.org>
|  date:        Tue Apr 05 01:35:58 2016 +0000
|  files:       tests/run-tests.py
|  description:
|  run-tests: add support for RTUNICODEPEDANTRY environment variable
|
|  based on 73e4a02e6d23
|
|
o  changeset:   33949:8adee574f295
|  topic:       runtests
|  user:        timeless <timeless at mozdev.org>
|  date:        Fri May 06 19:17:49 2016 +0000
|  description:
|  tests: use absolute_import
|
|  This is a step to adding a mercurial dependency to simplify py3 compat
|
|
o  changeset:   33948:e597b8fa6c41
|  topic:       runtests
|  user:        timeless <timeless at mozdev.org>
|  date:        Fri May 06 19:16:16 2016 +0000
|  description:
|  tests: use open() instead of file() for py3 compat in test-archive.t
|
|
o  changeset:   33947:d2e76972ab86
|  topic:       runtests
|  user:        timeless <timeless at mozdev.org>
|  date:        Fri May 06 19:15:37 2016 +0000
|  description:
|  tests: use print_function in test-archive.t
|
|
o  changeset:   33946:3331b0f27af3
|  topic:       runtests
~  user:        timeless <timeless at mozdev.org>
   date:        Fri May 06 19:08:46 2016 +0000
   files:       tests/get-with-headers.py
   description:
   tests: handle httplib py3 divergence in get-with-headers.py

   With this final change, get-with-headers.py works in Python 3


The reason that the commits are empty is that upstream has them:
[timeless at gcc2-power8 crew]$ hg log -Gr 'desc("print_function") and
desc("test-archive.t")'
o  changeset:   33947:d2e76972ab86
:  topic:       runtests
:  user:        timeless <timeless at mozdev.org>
:  date:        Fri May 06 19:15:37 2016 +0000
:  summary:     tests: use print_function in test-archive.t
:
o  changeset:   33737:df6b5c6d252a
|  user:        timeless <timeless at mozdev.org>
~  date:        Fri May 06 19:15:37 2016 +0000
   summary:     tests: test-archive.t use print_function

x  changeset:   33162:5e44aad4d3f9
|  topic:       runtests
~  user:        timeless <timeless at mozdev.org>
   date:        Fri May 06 19:15:37 2016 +0000
   summary:     tests: test-archive.t use print_function

[timeless at gcc2-power8 crew]$ hg debugancestor 33737 committed/default
33737:df6b5c6d252ab39a1ab0afdf00635f2c59ca58d2

Blackbox log shows that rebase created the commit:
2016/05/25 17:41:53 timeless
@2552aa1a3486251c586ee162d5998588ab890015+c5dfd864d81f5d1f435ff376ea44b3ea82b12575+
(69190) [command]> rebase --cont
2016/05/25 17:41:53 timeless
@2552aa1a3486251c586ee162d5998588ab890015+c5dfd864d81f5d1f435ff376ea44b3ea82b12575+
(69190) [tagscache]> 874/874 cache hits/lookups in 0.0189 seconds
...
2016/05/25 17:41:56 timeless @2552aa1a3486251c586ee162d5998588ab890015+ (69190)
[branchcache]> updated base branch cache in 1.8262 seconds
...
2016/05/25 17:41:58 timeless @606484cd6240597406145dd62092e9b51beca6be (69190)
[branchcache]> updated served branch cache in 0.1699 seconds
...
2016/05/25 17:41:59 timeless @064d39cb447df9266c5c779e4b1af547b533b902+ (69190)
[branchcache]> updated served branch cache in 0.1711 seconds
...
2016/05/25 17:42:00 timeless
@3331b0f27af3aaa5caa2cde733570479c8720452+e153363e62897362bab569db39de704469604698+
(69190) [commandfinish]> rebase --cont exited 1 after 7.38 seconds
2016/05/25 17:42:36 timeless
@3331b0f27af3aaa5caa2cde733570479c8720452+e153363e62897362bab569db39de704469604698+
(70592) [command]> resolve -l
2016/05/25 17:42:36 timeless
@3331b0f27af3aaa5caa2cde733570479c8720452+e153363e62897362bab569db39de704469604698+
(70592) [commandfinish]> resolve -l exited 0 after 0.35 seconds
2016/05/25 17:42:37 timeless
@3331b0f27af3aaa5caa2cde733570479c8720452+e153363e62897362bab569db39de704469604698+
(70615) [command]> resolve -m
2016/05/25 17:42:37 timeless
@3331b0f27af3aaa5caa2cde733570479c8720452+e153363e62897362bab569db39de704469604698+
(70615) [commandfinish]> resolve -m exited 0 after 0.12 seconds
2016/05/25 17:42:43 timeless
@3331b0f27af3aaa5caa2cde733570479c8720452+e153363e62897362bab569db39de704469604698+
(73969) [command]> rebase --cont
2016/05/25 17:42:44 timeless
@3331b0f27af3aaa5caa2cde733570479c8720452+e153363e62897362bab569db39de704469604698+
(73969) [tagscache]> writing 96 bytes to cache/hgtagsfnodes1
...
2016/05/25 17:42:46 timeless @3331b0f27af3aaa5caa2cde733570479c8720452 (73969)
[branchcache]> updated base branch cache in 1.8751 seconds
...
2016/05/25 17:42:48 timeless @d2e76972ab86987b9b2120ba02750d1b65b7393a (73969)
[branchcache]> updated served branch cache in 0.1719 seconds
...
2016/05/25 17:42:48 timeless
@e597b8fa6c41b9a1d90284502a6b5225f16b0ca5+f61d065c6bf380de0736ec551a9bb4384a8ab63f+
(73969) [commandfinish]> rebase --cont exited 1 after 4.81 seconds

(I was rebasing to get rid of commits that were already upstreamed...)

expected results:
normally, rebase will spit out:
                        ui.warn(_('note: rebase of %d:%s created no changes '
                                  'to commit\n') % (rev, ctx))

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list