Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • thg thg
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 838
    • Issues 838
    • List
    • Boards
    • Service Desk
    • Milestones
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • mercurialmercurial
  • TortoiseHgTortoiseHg
  • thgthg
  • Issues
  • #5719
Closed
Open
Issue created May 19, 2021 by Artalus@Artalus

TypeError in "Compress History" dialog

In "Compress History" RMB dialog, after you succesfully compressed changes in commits and click "Commit" button, THG displays this bug report:

#!python
** Mercurial version (5.8).  TortoiseHg version (5.8+3-582e49bf29ae)
** Command: 
** CWD: /home/user
** Encoding: UTF-8
** Extensions loaded: clonebundles, extdiff, graphlog, histedit, largefiles, mq, purge, rebase, strip, tortoisehg.util.configitems
** Python version: 3.9.2 (default, Feb 20 2021, 18:40:11) [GCC 10.2.0]
** System: Linux hostname 5.4.105-1-MANJARO #1 SMP PREEMPT Thu Mar 11 18:27:58 UTC 2021 x86_64
** Qt-5.15.2 PyQt-5.15.4 QScintilla-2.12.1
Traceback (most recent call last):
  File "/home/user/.local/lib/python3.9/site-packages/tortoisehg/hgqt/compress.py", line 124, in commit
    revs = [c for c in self.repo.revs(b'%s::%s' % (base, tip)) if c != base]
TypeError: %b requires a bytes-like object, or an object that implements __bytes__, not 'int'

I tinkered with the code a bit, and found this:

  • in tortoisehg/hgqt/repowidget.py during def compressRevisionsPair(self) the variables reva, revb = self._selectedIntRevisionsPair() contain two integers like 19895, 19898 - numbers of revisions being compressed
  • in tortoisehg/hgqt/compress.py these are stored into self.revs = revs during class CompressDialog construction
  • in same class during def commit(self) they are used in format-string b'%s::%s' % (base, tip), that apparently used to work with strings (likely revision hashes) in the past.

It seems like simply replacing %s with %d is enough to fix the issue - clicking on "Commit" now creates a commit dialog with pre-filled commit message.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking