Make post-review warn if installed version of git-svn is too old
Updated 8 months, 3 weeks ago
| Marc Hedlund | Reviewers | ||
| reviewboard | |||
| None | Review Board SVN | ||
I installed git-svn the other day with an out-of-date MacPorts index, and wound up with version 1.5.3.7 installed. It turns out that 'git svn info', which is used by post-review to find repository information, wasn't added until git 1.5.4 (see http://www.kernel.org/pub/software/scm/git/docs/RelNotes-1.5.4.txt ). This adds a version check for git-svn which is run if git svn info fails, and which lets the user know that the git-svn version is out of date.
Tested against my old 1.5.3.7 install and my new, hotter 1.5.4.4 install.
| /trunk/reviewboard/contrib/tools/post-review | |||
|---|---|---|---|
| Revision 1264 | New Change | ||
| ... | 840 lines hidden [Expand] | ||
| 841 | 841 | ||
| 842 | if m: |
842 | if m: |
| 843 | base_path = m.group(1)[len(path):] |
843 | base_path = m.group(1)[len(path):] |
| 844 | self.type = "svn" |
844 | self.type = "svn" |
| 845 | return RepositoryInfo(path=path, base_path=base_path) |
845 | return RepositoryInfo(path=path, base_path=base_path) |
| 846 | else: |
||
| 847 | # Versions of git-svn before 1.5.4 don't (appear to) support |
||
| 848 | # 'git svn info'. If we fail because of an older git install, |
||
| 849 | # here, figure out what version of git is installed and give |
||
| 850 | # the user a hint about what to do next. |
||
| 851 | version = execute("git svn --version", ignore_errors=True) |
||
| 852 | version_parts = re.search('version (\d+)\.(\d+)\.(\d+)', |
||
| 853 | version) |
||
| 854 | if version_parts and not is_valid_version((version_parts.group(1), |
||
| 855 | version_parts.group(2), |
||
| 856 | version_parts.group(3)), |
||
| 857 | (1, 5, 4)): |
||
| 858 | die("Your installation of git-svn must be upgraded to " + \ |
||
| 859 | "version 1.5.4 or later") |
||
| 846 | 860 | ||
| 847 | # Okay, maybe Perforce. |
861 | # Okay, maybe Perforce. |
| 848 | # TODO |
862 | # TODO |
| 849 | 863 | ||
| 850 | # Nope, it's git then. |
864 | # Nope, it's git then. |
| 851 | # TODO |
865 | # TODO |
| 852 | return None |
866 | return None |
| 853 | 867 | ||
| 868 | def is_valid_version(actual, expected): |
||
| 869 | """ |
||
| 870 | Takes two tuples, both in the form: |
||
| 871 | (major_version, minor_version, micro_version) |
||
| 872 | Returns true if the actual version is greater than or equal to |
||
| 873 | the expected version, and false otherwise. |
||
| 874 | """ |
||
| 875 | return (expected[0] > actual[0]) or \ |
||
| 876 | (expected[0] == actual[0] and expected[1] > actual[1]) or \ |
||
| 877 | (expected[0] == actual[0] and expected[1] == actual[1] and \ |
||
| 878 | expected[2] >= actual[2]) |
||
| 879 | |||
| 854 | def scan_for_server(self, repository_info): |
880 | def scan_for_server(self, repository_info): |
| 855 | # Scan first for dot files, since it's faster and will cover the |
881 | # Scan first for dot files, since it's faster and will cover the |
| 856 | # user's $HOME/.reviewboardrc |
882 | # user's $HOME/.reviewboardrc |
| 857 | 883 | ||
| 858 | # TODO: Maybe support a server per remote later? Is that useful? |
884 | # TODO: Maybe support a server per remote later? Is that useful? |
| ... | 419 lines hidden [Expand] | ||
- /trunk/reviewboard/contrib/tools/post-review: 2 changes [ 1 2 ]
Other reviews