1. TortoiseHg
  2. TortoiseHg
  3. thg

Commits

Yuya Nishihara  committed e58f19a

cmdui: always set percentage to QProgressBar (fixes #2261)

Mercurial's progress value can exceed INT_MAX when cloning repository over 2GB,
which causes TypeError on x86 and would result invalid value even on amd64
because C int is 32bit.

To avoid the problem, this patch simply converts progress value to percentage.

  • Participants
  • Parent commits 7b7ed56
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/cmdui.py

View file
         self.idle = True
 
     def setcounts(self, cur, max):
-        self.pbar.setMaximum(max)
-        self.pbar.setValue(cur)
+        # cur and max may exceed INT_MAX, which confuses QProgressBar
+        assert max != 0
+        self.pbar.setMaximum(100)
+        self.pbar.setValue(int(cur * 100 / max))
 
     def unknown(self):
         self.pbar.setMinimum(0)