Opened 9 years ago
Closed 9 years ago
#12182 closed enhancement (fixed)
short_rev and display_rev should always return a string
Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Milestone: | 1.2 |
Component: | version control | Version: | |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: |
|
||
API Changes: | |||
Internal Changes: |
Description (last modified by )
Discussed in #12179, the API should document that short_rev
and display_rev
return a string, and the Subversion implementation should be modified to return a string rather than an integer. Since short_rev
and display_rev
call normalize_rev
, it may be that the latter only needs to be modified.
Attachments (1)
Change History (5)
comment:1 by , 9 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
by , 9 years ago
Attachment: | t12182.diff added |
---|
comment:2 by , 9 years ago
comment:3 by , 9 years ago
I tried the patch and got 4 failures.
FAIL: test_repos_display_rev (tracopt.versioncontrol.svn.tests.svn_fs.SubversionRepositoryNormalTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "tracopt/versioncontrol/svn/tests/svn_fs.py", line 140, in test_repos_display_rev self.assertEqual(str(HEAD), self.repos.display_rev(None)) AssertionError: '30' != 30
Probably, the following would solve it.
-
trac/versioncontrol/api.py
diff --git a/trac/versioncontrol/api.py b/trac/versioncontrol/api.py index b22bca4be..62a3cc7ec 100644
a b class Repository(object): 1019 1019 1020 1020 :raise NoSuchChangeset: If the given `rev` isn't found. 1021 1021 """ 1022 norm_rev = self.normalize_rev(rev)1023 return str( norm_rev) if rev is not None else norm_rev1022 rev = self.normalize_rev(rev) 1023 return str(rev) if rev is not None else rev 1024 1024 1025 1025 def display_rev(self, rev): 1026 1026 """Return a string representation of a revision in the repos for … … class Repository(object): 1031 1031 1032 1032 :raise NoSuchChangeset: If the given `rev` isn't found. 1033 1033 """ 1034 norm_rev = self.normalize_rev(rev)1035 return str( norm_rev) if rev is not None else norm_rev1034 rev = self.normalize_rev(rev) 1035 return str(rev) if rev is not None else rev 1036 1036 1037 1037 @abstractmethod 1038 1038 def get_changes(self, old_path, old_rev, new_path, new_rev,
comment:4 by , 9 years ago
Description: | modified (diff) |
---|---|
Release Notes: | modified (diff) |
Resolution: | → fixed |
Status: | assigned → closed |
Thanks for review. Committed to trunk in [14273].
Proposed change in attachment:t12182.diff.