diff --git a/eden/scm/sapling/changelog.py b/eden/scm/sapling/changelog.py index 29bfeae6d75f9..eed6172f769f7 100644 --- a/eden/scm/sapling/changelog.py +++ b/eden/scm/sapling/changelog.py @@ -14,7 +14,7 @@ import subprocess import textwrap -from typing import Dict, List, Optional +from typing import Dict, List, Optional, Tuple, Union import bindings @@ -312,7 +312,7 @@ def gitcommittext( parents: List[bytes], desc: str, user: str, - date: Optional[str], + date: Optional[Union[str, Tuple[Union[int, float], int]]], extra: Optional[Dict[str, str]], gpgkeyid: Optional[str] = None, ) -> bytes: @@ -390,12 +390,14 @@ def gitcommittext( if date != authordate and date != committerdate: authordate = date + author_time, author_tz = util.parsedate(authordate) + # see Rust format-util GitCommitFields for available fields fields = { "tree": tree, "parents": parents, "author": user, - "date": util.parsedate(authordate), + "date": (int(author_time), author_tz), "committer": committer, "committer_date": util.parsedate(committerdate), "message": desc, diff --git a/eden/scm/tests/test-histedit-git.t b/eden/scm/tests/test-histedit-git.t index 083ebcc28cb98..cb24edbba09fd 100644 --- a/eden/scm/tests/test-histedit-git.t +++ b/eden/scm/tests/test-histedit-git.t @@ -15,25 +15,18 @@ setup repo folding should work -FIXME: histedit should work - $ hg histedit -q --commands - 2>&1 << EOF | tail -n 5 + $ hg histedit --commands - << EOF > pick fd2a67d81220 'A1' > pick bc8bd49c677f 'A2' > fold 081c9e396fa1 'A3' > pick 91ad706dafee 'A4' > EOF - File *, in add (glob) - text = gitcommittext( - File *, in gitcommittext (glob) - text = to_text(fields).encode() - TypeError: 'float' object cannot be interpreted as an integer $ hg st - A A3 $ tglog - o 91ad706dafee 'A4' + @ 17e3aa7dc15f 'A4' │ - o 081c9e396fa1 'A3' - │ - @ bc8bd49c677f 'A2' + o 594d4e89c0ff 'A2 │ + │ *** + │ A3' o fd2a67d81220 'A1'