Typo in .hgsub renders revisions un-checkout-able

Greg Ward greg at gerg.ca
Wed Nov 21 11:11:11 CST 2012


Hi all --

I'm using git subrepos, and yesterday I made a mistake adding a new
subrepo. See if you can spot the typo:

  --- a/.hgsub
  +++ b/.hgsub
  @@ -2,3 +2,4 @@
   src/github.com/cznic/golex  = [git]git://github.com/cznic/golex
   src/github.com/cznic/lexer  = [git]git://github.com/cznic/lexer
   src/github.com/cznic/lex    = [git]git://github.com/cznic/lex
  +src/github.com/stretchrcom/testify = [git]:git://github.com/stretchrcom/testify

Yep, an extra colon snuck in right after "[git]". Oops, my mistake.
100% user error and I'll fix it as soon as I can.

Unfortunately, the changeset resulting from this commit cannot be
checked out:

  $ hg up 73
  cloning subrepo src/github.com/stretchrcom/testify from ssh://lucifer/src/fubsy/:git:/github.com/stretchrcom/testify
  fatal: '/src/fubsy/:git:/github.com/stretchrcom/testify' does not appear to be a git repository
  fatal: The remote end hung up unexpectedly
  abort: git clone error 128 in src/github.com/stretchrcom/testify

"ssh://lucifer/src/fubsy" is paths.default in my container repo, so I
guess the stray colon causes URL parsing confusion -- the resulting
URL makes no sense to git, so no wonder it fails.

On reflection, I'm guessing that *any* error in the URL for a git
subrepo could cause this problem. This seems like a serious usability
problem. You should not be able to commit a changeset that you cannot
update to later. Probably instead of an abort, you should get a big
noisy warning like

  failed to clone git subrepo: your working directory is inconsistent!
  (maybe you need to fix .hgsub so git clone works?)

Thoughts?

       Greg


More information about the Mercurial-devel mailing list