Thursday, January 05, 2012

hg schemes extension

http://mercurial.selenic.com/wiki/SchemesExtension

I like the idea of this extension, that allows you to create shortcuts for URLs you use often, e.g. cloning.

E.g.


[extensions]
hgext.schemes=

[schemes]
ups = ssh://my-uarch-performance-simulator/...


However, it is something of a no-sale when I saw that the URL was notexpanded in the clone:


> hg clone ups: u
...
> cd u
> hg paths
default = ups://
> 



Or in WorkDir/.hg/hgrc


[paths]
default = ups:

PRO: when the remote repository changges location, this *might* allow you to change the scheme URL shorthand in hgrc, and have things work in the possibly multiple clones you have outstanding.

CON: it loses some documentation. If I got run over by a beer truck, my replacement might have trouble finding where it was from.  Worse, if a repo was restored from backup (particularly if people keep branches as repos), and my home directory with the ~/.hgrc enabling SchemesExtension was  not present.

I'm not sure what I would like. Possibly always expand the shorthand.  Possibly record the shorthand with the long path as a comment:
[paths]
default = ups: # ssh://my-uarch-performance-simulator/...
> hg paths
default = ups:// # ssh://my-uarch-performance-simulator/...




TBD: move this to my wiki Category:VCS.

No comments:

Post a Comment