Mercurial > public > mercurial-scm > hg-stable
diff mercurial/commands.py @ 17292:8da6fe276a23 stable
debugobsolete: do not traceback on invalid node identifiers
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Mon, 30 Jul 2012 19:26:05 +0200 |
parents | 4e35dea77e31 |
children | e51d4aedace9 |
line wrap: on
line diff
--- a/mercurial/commands.py Mon Jul 30 15:48:04 2012 +0200 +++ b/mercurial/commands.py Mon Jul 30 19:26:05 2012 +0200 @@ -2067,17 +2067,31 @@ _('[OBSOLETED [REPLACEMENT] [REPL... ]')) def debugobsolete(ui, repo, precursor=None, *successors, **opts): """create arbitrary obsolete marker""" + def parsenodeid(s): + try: + # We do not use revsingle/revrange functions here to accept + # arbitrary node identifiers, possibly not present in the + # local repository. + n = bin(s) + if len(n) != len(nullid): + raise TypeError() + return n + except TypeError: + raise util.Abort('changeset references must be full hexadecimal ' + 'node identifiers') + if precursor is not None: metadata = {} if 'date' in opts: metadata['date'] = opts['date'] metadata['user'] = opts['user'] or ui.username() - succs = tuple(bin(succ) for succ in successors) + succs = tuple(parsenodeid(succ) for succ in successors) l = repo.lock() try: tr = repo.transaction('debugobsolete') try: - repo.obsstore.create(tr, bin(precursor), succs, 0, metadata) + repo.obsstore.create(tr, parsenodeid(precursor), succs, 0, + metadata) tr.close() finally: tr.release()