The command arc browse FILE now support Subversion repositories.
It's not very clear if this ever worked for a period before 2020:
Anyway, now it works.
Closes T15541
Differential D25823
arc browse: add support to Subversion repos valerio.bozzolan on Sep 10 2024, 11:26. Authored by
Details
The command arc browse FILE now support Subversion repositories. It's not very clear if this ever worked for a period before 2020: Anyway, now it works. Closes T15541 In a random Phorge, create a new Subversion repository in Diffusion README.md trunk/lol.txt /tags/17_04_2019/lol.txt Then clone that repository with your usual URL, that is: svn checkout svn+ssh://phab@phorge.localhost/source/example-svn-repository example-svn-repository All of these work:
In the very same repository, manually go to the Diffusion > Subversion menu and set "trunk/" All of these still work:
Inside the directory of arcanist, all of these work as expected, opening the browser
The browser web carefully opens as expected.
Diff Detail
Event TimelineComment Actions Note that I introduced the method isBranchJustFilesystemPath() that returns something different for Subversion, just to recognize Subversion, So in the future we can replace some occurrences in this way that is less hacky and more object-oriented: - if ($api instanceof ArcanistSubversionAPI) { + if ($api->isBranchJustFilesystemPath()) { I have not a strong opinion against the name of that method. 🤔 I've invested all my creativity there, so, suggestions are very welcome. Comment Actions a. I'm not sure I like isBranchJustFilesystemPath() to check Is this SVN - if we're trying to be generic, then there may be a different vcs that does this particular trick, but has different logic; And if we're not trying to be generic, then isSVN() is probably a good-ish name? or isVCS('SVN'). b. If the user explicitly specifies a branch, shouldn't that take precedent over whatever is calculated from the $api? c. don't we have a matching logic for "get branch" for other VCSes?
Comment Actions Some thoughts:
Comment Actions Maybe I should just try to improve the ArcanistRepositoryAPI#getDefaultBranch() 🤔 since the root problem is there, and the current solution just involves more code to avoid to fallback on that "master" default Comment Actions mm, isBranchJustFilesystemPath() makes more sense now, as in "the branch name is part of the URI path"... Also, I think I've literally never used SVN with Arc/Phabricator. if "branch" is just part of the path, wouldn't the full file-path be the same in the local disk and in the server repository? Comment Actions Nice 👌
That's an interesting wild experience. In the company I work for, they have kind of 100/200 SVN repositories, and Phorge saves their life.
I've wrote this comment for 20 minutes to answer correctly. The short answer is yes, you are probably very right. So probably, even if arc browse is useful, arc browse --branch in Subversion still has probably completely no sense in 99.99999% of cases... Let's pretend to have this remote repository structure: /README.md /trunk/lol.txt /tags/17_04_2019/lol.txt /tags/17_04_2020/lol.txt /tags/17_04_2021/lol.txt The above directory structure is surprisingly common. Note that the "trunk" directory is just a directory (that is the "master") and the "tags" directory is just a directory (with copy-pasted old versions of trunk in it - let's say - lol). Anything really is just a directory: yes, worldwide Subversion users just somehow communicated to each-other that the "trunk" directory contains the last version; and the "tags" directory contain old versions. That's it. Don't ask me why. LOL Subversion users can download everything with: svn checkout svn+ssh://phab@phorge.example.com/source/myrepo myRepoComplete And they obtain on your computer the very exact remote complete structure. At this point you can run arc browse correctly. Some working examples: $ arc browse README.md http://phorge.localhost/source/myrepo/browse/README.md $ arc browse trunk/lol.txt http://phorge.localhost/source/myrepo/browse/trunk/lol.txt $ arc browse tags/17_04_2021/lol.txt http://phorge.localhost/source/myrepo/browse/tags/17_04_2021/lol.txt And it works. At this point you may also try some "intuitive" things, like, opening lol.txt on a different "branch" but... it's interestingly nonsense. $ arc browse --branch tags/17_04_2021 trunk/lol.txt → 404 page: http://phorge.localhost/source/myrepo/browse/tags/17_04_2021/trunk/lol.txt → expected: http://phorge.localhost/source/myrepo/browse/tags/17_04_2021/lol.txt → but we really cannot imagine that... how we should strip "trunk/"? $ # Maybe this? $ arc browse --branch tags/17_04_2021 lol.txt → Unable to resolve argument "lol.txt" Or, what about opening tags/17_04_2021/lol.txt but on the trunk? $ arc browse --branch trunk tags/17_04_2021/lol.txt → 404 page: http://phorge.localhost/source/myrepo/browse/trunk/tags/17_04_2021/lol.txt → expected: http://phorge.localhost/source/myrepo/browse/trunk/lol.txt → but we really cannot imagine that... how we should strip "tags/17_04_2021/"? In short, this seems just nonsense. Also... Subversion users can also download just part of the remote tree. That's interesting. For example, you can download only the trunk and only work on that: svn checkout svn+ssh://phab@phorge.example.com/source/myrepo/trunk myRepoOnlyTrunk The above command in fact only downloads the trunk/ and it only generates this filesystem structure under myRepoOnlyTrunk: /.svn /lol.txt So, even in the above situation, now arc browse lol.txt surprisingly works and gets the expected remote URL on the trunk. But what about our esoteric intention to open the file lol.txt on the branch /tags/17_04_2019? $ arc browse --branch tags/17_04_2019 lol.txt → 404 page: https://sviluppo.erinformatica.it/source/fe_data_imprt/browse/tags/17_04_2019/trunk/lol.txt In ShortPremising that arc browse would be still super-useful also in Subversion, We we should probably block the feature arc browse --branch for Subversion users, since this only leads to a path full of tears and madness. Comment Actions Ok, so --branch probably doesn't make much sense in that case, right. What if the user used the svn checkout svn+ssh://phab@phorge.example.com/source/myrepo/trunk myRepoOnlyTrunk form - are we still able to find the right target when arc browse lol.txt? Is it a common use-case? |