linux - Broken Mercurial Repo -


i did revursive sed on root directory, , when tried commit, or hg besides hg --help, stack trace. incorrectly assumed .hg directory write protected when did sed.

the repo local machine.

is there way me recover changelog or commit comments? found file called 00changelog.i in .hg dir, it's binary file doesn't execute.

the sed commands:

find . -type f -exec sed -i.bak "s/sim-config.h/config.h/g" {} \; find . -type f -exec sed -i.bak "s/av-config.h/config.h/g" {} \; 

the stack trace:

traceback (most recent call last):   file "/usr/bin/hg", line 27, in <module>     mercurial.dispatch.run()   file "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 16, in run     sys.exit(dispatch(sys.argv[1:]))   file "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 30, in dispatch     return _runcatch(u, args)   file "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 50, in _runcatch     return _dispatch(ui, args)   file "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 470, in _dispatch     return runcommand(lui, repo, cmd, fullargs, ui, options, d)   file "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 340, in runcommand     ret = _runcommand(ui, options, cmd, d)   file "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 521, in _runcommand     return checkargs()   file "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 475, in checkargs return cmdfunc()   file "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 469, in <lambda>     d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)   file "/usr/lib/python2.6/site-packages/mercurial/util.py", line 401, in check     return func(*args, **kwargs)   file "/usr/lib/python2.6/site-packages/mercurial/commands.py", line 712, in commit     node = cmdutil.commit(ui, repo, commitfunc, pats, opts)   file "/usr/lib/python2.6/site-packages/mercurial/cmdutil.py", line 1151, in commit     return commitfunc(ui, repo, message, match(repo, pats, opts), opts)   file "/usr/lib/python2.6/site-packages/mercurial/commands.py", line 710, in commitfunc     editor=e, extra=extra)   file "/usr/lib/python2.6/site-packages/mercurial/localrepo.py", line 787, in commit     changes = self.status(match=match, clean=force)   file "/usr/lib/python2.6/site-packages/mercurial/localrepo.py", line 1015, in status     listclean, listunknown)   file "/usr/lib/python2.6/site-packages/mercurial/dirstate.py", line 614, in status     dmap = self._map   file "/usr/lib/python2.6/site-packages/mercurial/util.py", line 156, in __get__     result = self.func(obj)   file "/usr/lib/python2.6/site-packages/mercurial/dirstate.py", line 58, in _map     self._read()   file "/usr/lib/python2.6/site-packages/mercurial/dirstate.py", line 228, in _read     p = parsers.parse_dirstate(self._map, self._copymap, st) 

if have no upstream source can replace .hg clone with, depend on how badly mucked files are. however, noticed, mercurial stores files internally in binary format make harder repair hand.

presumably did not run sed -i.bak in-place backup (which make easy restore).

you can like:

find .hg -mmin -60 -print 

to see files modified in past (say) 60 minutes. maybe not modified , can find way reverse effects of sed command on file (but impossible if ran /foo/d).

for future, may worth signing free account on http://bitbucket.org/ give free private repository hosting , backup location.


Comments