Closed dholbert closed 13 years ago
I support this, it will make possible to use sparkleshare with bitbucket, which offers unlimited space for private repositories on the free account.
This won't happen except when someone steps up and does it. Which is very unlikely, so closing...
I was looking at this, but didn't have time to look much at the code. If you can explain more or less which functions should be modified, I can try again..
All you need to change are the SparkleFetcher and SparkleRepo classes. Perhaps you can subclass them and override the needed methods.
ok, I'll let you know in a while.
I've added basic (no event log support) to the 'backend' branch. check it out!
I'm curious what advantages will mercurial offer over git?
edit: how do I add a repo to sparkleshare that uses mercurial, do I need to check out the new branch?
@lgordon I don't know either... But more choice is good. It was mainly an experiment to test the abstraction. Also, now people can add any backend they'd like.
I just created a new hg repo (hg init) on my server and then I added it to sparkleshare just like I normally would, it then crashed and gave this error:
note my version of mercurial (hg) is from the oracle solaris repos (v. 1.3.1)
[20:18:25][Controller] Formed URL: ssh://git@prometheus/data/git/hgtest [20:18:25][Fetcher][/home/lyle/SparkleShare/.tmp/hgtest] Fetching folder... [20:18:25][Cmd] /opt/local/bin/hg clone "ssh://git@prometheus/data/git/hgtest" "/home/lyle/SparkleShare/.tmp/hgtest"
Unhandled Exception: System.ComponentModel.Win32Exception: ApplicationName='/opt/local/bin/hg', CommandLine='clone "ssh://git@prometheus/data/git/hgtest" "/home/lyle/SparkleShare/.tmp/hgtest"', CurrentDirectory='/home/lyle/SparkleShare/.tmp'
at System.Diagnostics.Process.Start_noshell (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x00000] in
@lgordon you need to have hg in /opt/local/bin/hg. btw, it doesn't really make sense to report bugs against this branch yet, it still has too many known flaws.
@hbons I was stupid and installed hg on my server but not on the local machine, I'll just play around with it and not bug you. Thanks!
I tried to fix the problem on my own but I don't really know exactly where the error is occuring
on line 35 of SparkleFetcherMercurial.cs:
"clone \"" + base.remote_url + "\" " + "\"" + base.target_folder + "\"");
in the base.remote_url, mercurial requires an additional slash "/" to specify the folder
ie.
hg clone "ssh://git@prometheus/data/git/hgtest" doesn't work but
hg clone "ssh://git@prometheus//data/git/hgtest" will work
I can't figure out how to implement this change. I know you said not to report bugs but I figure I would point it out.
@lgordon, if I am right the url is created at SparkleIntro.css line 325 or 438.
@wimh, That looks right, I figure adding another slash would fix hg but probably break git, I guess that this part needs to be abstracted so the git/hg versions can be different.
Since sparkleshare won't allow the 2nd / for Hg to access repos that aren't in the home directory I just create a symlink to my repo in the git users home directory and was then able to add it succesfully, however, when I clicked to get the log it crashed.
I figured I would post the log here but maybe the log just isnt supported yet, Thanks!
[18:35:04][Controller] Formed URL: ssh://git@prometheus/hgtest [18:35:04][Fetcher][/home/lyle/SparkleShare/.tmp/hgtest] Fetching folder... [18:35:04][Cmd] /opt/local/bin/hg clone "ssh://git@prometheus/hgtest" "/home/lyle/SparkleShare/.tmp/hgtest" [18:35:05][Hg] Exit code 0 [18:35:05][Config] Added configuration to '/home/lyle/SparkleShare/.tmp/hgtest/.hg/hgrc' [18:35:05][Fetcher][/home/lyle/SparkleShare/.tmp/hgtest] Fetching finished [18:35:05][Cmd] /opt/local/bin/hg log --limit 1 --template "{node}" [18:35:05][Cmd] /opt/local/bin/hg log -r : --limit 1 --template "{node}" [18:35:05][ListenerFactory] Refered to existing listener for 204.62.14.135 [18:35:05][Cmd] /opt/local/bin/hg status [18:35:14][Cmd] /opt/local/bin/hg log --limit 30 --style /home/lyle/SparkleShare/hgtest/.hg/log.style
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object
at SparkleShare.SparkleLog.GenerateHTML () [0x00000] in
@lgordon yes, i haven't implemented the log yet. It seems to be very hard to get a commit log with changed files from Hg....
well I can report that adding files to hg repos hosted on my server works!!
also the hgweb cgi script is super easy to install (much simpler than git-web) and i can browse the contents of my sparkleshare hg repo through my mini-httpd server
@lgordon good to hear! the log bit is the only bit i have left to do. if you can find out how i can get a list of commits with: hash, iso timestamp, username, user email, files added, files deleted and files modified, that would be great! (the file names need to be wrapped by quotes if there's a space in the filename, or just all quoted.)
@hbons how about?
hg log --verbose:
changeset: 0:27d23b0716da tag: tip user: Lyle Gordon lgordon@gmail.com date: Sun May 22 18:38:39 2011 -0500 files: fulltext.pdf description: SparkleShare Hg
@lgordon too easy. :) doesn't list what happened to the files.
@hbons
hg log --style changelog --verbose --stat
seems to have all the needed information as far as I can tell
edit: you can also make a new template that --style refers to, these control the output of the log command. The existing ones are default, compact and changelog (supposed to follow the GNU changelog guidelines). They seem to be stored in different places, on my ubuntu machine they are in /usr/share/mercurial/templates/ but on my solaris box where I installed Hg from source via python they are in the python directory somewhere
lost of info here: http://hgbook.red-bean.com/read/customizing-the-output-of-mercurial.html
just got a notification to myself from a hg repo but I had open/closed/rebuilt sparkleshare a few times
I deleted and planned to recreate my hg repo but now sparkleshare keeps trying to add it as a git repo and this obviously fails. Is there a way to tell it exactly what protocol to use?
Before I broke it the log worked! (no username showed up though)
@lgordon just append ".hg" to the folder name. This will be automatic in the future, though I'm not sure how yet.
@hbons - thanks it works
just for curiosity I created a fresh hg and git repo added them with sparkleshare and then droped a 729MB folder with 46 items (compressed and uncompressed files).
Both times it took almost exactly 4minutes to complete the sync. Seemed to be limited by my server CPU (its a low power AMD E-350). The actual transfer was pretty fast over gigabit ethernet. I figured it would be interesting to compare hg and git but they turned out to be pretty similar.
@lgordon? 4 minutes? not bad at all :)
@lgordon i implemented event log support based on the command you gave me. can you check if it works?
@hbons its not perfect - at first glance its missing the user name (which is in the output from the log command) but i compared it to the git log support for the same uploaded folder and the git is much more detailed, see here:
https://github.com/lgordon/sparkle/raw/master/Screenshot.png
edit: didn't notice you just pushed new changes I'm rebuilding edit2: looks pretty much the same except it shows the username now
is the file list the same as running the hg log command?
nope many more files in the log here is the output: **it seems the --stat option has a big overhead and is really slow, it might not actually be needed since it only tells you what changed
lyle@lyle-VGN-Z590N:~/SparkleShare/hgtest$ hg log --style changelog --verbose 2011-05-23 15:33 -0500 Lyle Gordon lgordon@gmail.com (14d6a60fbaf0 [tip])
* mount prometheus.sh: deleted file.
* mount prometheus.sh:
SparkleShare Hg
2011-05-23 15:33 -0500 Lyle Gordon lgordon@gmail.com (c088b3326883)
* dap1522_manual_130.pdf: deleted file.
* dap1522_manual_130.pdf:
SparkleShare Hg
2011-05-23 15:33 -0500 Lyle Gordon lgordon@gmail.com (f4fae31a0486)
* dap1522_manual_130.pdf: new file.
* dap1522_manual_130.pdf:
SparkleShare Hg
2011-05-23 11:52 -0500 Lyle Gordon lgordon@gmail.com (a9db5bbeb71a)
* UT/QIIIA Game Source (SDK) License.doc, UT/Urban Terror on the
Web.url, UT/autoexec.cfg, UT/demos/tutorial.dm_68,
UT/description.txt, UT/glsl/alpha_fragment.cfg,
UT/glsl/bloom_dof_fog_fragment.cfg, UT/glsl/bloom_fog_fragment.cfg,
UT/glsl/bloom_fragment.cfg, UT/glsl/combine2_fragment.cfg,
UT/glsl/fs_fragment_cheap.cfg, UT/glsl/fs_fragment_radbump.cfg,
UT/glsl/fs_fragment_radbump_offset.cfg, UT/glsl/fs_md5_basic.cfg,
UT/glsl/fs_rad_terrain_alpha.cfg,
UT/glsl/fs_terrain_alpha_cheap.cfg, UT/glsl/fs_vertex_light.cfg,
UT/glsl/fs_vertex_light_cheap.cfg, UT/glsl/fs_wireframe.cfg,
UT/glsl/hdrcull_fragment.cfg, UT/glsl/occ_fragment.cfg,
UT/glsl/occ_vertex.cfg, UT/glsl/pass_vertex.cfg,
UT/glsl/primary_projection_vertex.cfg, UT/glsl/row3_fragment.cfg,
UT/glsl/vs_md5_basic.cfg, UT/glsl/water_fragment.cfg,
UT/glsl/water_fragment_cheap.cfg, UT/glsl/water_vertex.cfg,
UT/glsl/world_vertex.cfg, UT/glsl/world_vertex_offset.cfg,
UT/glsl/world_vertex_wireframe.cfg, UT/mapcycle.txt, UT/q3ut.ico,
UT/readme41.txt, UT/scripts/foamyseawater.shader, UT/server.cfg,
UT/textures/twoseven/water_n.tga, UT/ut4_commune.pk3,
UT/zpak000.pk3, UT/zpak000_assets.pk3: new file.
* UT/QIIIA Game Source (SDK) License.doc, UT/Urban Terror on the
Web.url, UT/autoexec.cfg, UT/demos/tutorial.dm_68,
UT/description.txt, UT/glsl/alpha_fragment.cfg,
UT/glsl/bloom_dof_fog_fragment.cfg, UT/glsl/bloom_fog_fragment.cfg,
UT/glsl/bloom_fragment.cfg, UT/glsl/combine2_fragment.cfg,
UT/glsl/fs_fragment_cheap.cfg, UT/glsl/fs_fragment_radbump.cfg,
UT/glsl/fs_fragment_radbump_offset.cfg, UT/glsl/fs_md5_basic.cfg,
UT/glsl/fs_rad_terrain_alpha.cfg,
UT/glsl/fs_terrain_alpha_cheap.cfg, UT/glsl/fs_vertex_light.cfg,
UT/glsl/fs_vertex_light_cheap.cfg, UT/glsl/fs_wireframe.cfg,
UT/glsl/hdrcull_fragment.cfg, UT/glsl/occ_fragment.cfg,
UT/glsl/occ_vertex.cfg, UT/glsl/pass_vertex.cfg,
UT/glsl/primary_projection_vertex.cfg, UT/glsl/row3_fragment.cfg,
UT/glsl/vs_md5_basic.cfg, UT/glsl/water_fragment.cfg,
UT/glsl/water_fragment_cheap.cfg, UT/glsl/water_vertex.cfg,
UT/glsl/world_vertex.cfg, UT/glsl/world_vertex_offset.cfg,
UT/glsl/world_vertex_wireframe.cfg, UT/mapcycle.txt, UT/q3ut.ico,
UT/readme41.txt, UT/scripts/foamyseawater.shader, UT/server.cfg,
UT/textures/twoseven/water_n.tga, UT/ut4_commune.pk3,
UT/zpak000.pk3, UT/zpak000_assets.pk3:
SparkleShare Hg
2011-05-23 11:51 -0500 Lyle Gordon lgordon@gmail.com (6153d44328f3)
* mount prometheus.sh: new file.
* mount prometheus.sh:
SparkleShare Hg
2011-05-23 11:50 -0500 Lyle Gordon lgordon@gmail.com (5731a2008649)
* SparkleShare.txt: new file.
* SparkleShare.txt:
SparkleShare Hg
Filing this issue on extending SparkleShare to support Mercurial/hg (in addition to git) as its version-control backend.