##// END OF EJS Templates
debugobsolete: do not traceback on invalid node identifiers
Patrick Mezard -
r17292:8da6fe27 stable
parent child Browse files
Show More
@@ -2067,17 +2067,31 b' def debugknown(ui, repopath, *ids, **opt'
2067 2067 _('[OBSOLETED [REPLACEMENT] [REPL... ]'))
2068 2068 def debugobsolete(ui, repo, precursor=None, *successors, **opts):
2069 2069 """create arbitrary obsolete marker"""
2070 def parsenodeid(s):
2071 try:
2072 # We do not use revsingle/revrange functions here to accept
2073 # arbitrary node identifiers, possibly not present in the
2074 # local repository.
2075 n = bin(s)
2076 if len(n) != len(nullid):
2077 raise TypeError()
2078 return n
2079 except TypeError:
2080 raise util.Abort('changeset references must be full hexadecimal '
2081 'node identifiers')
2082
2070 2083 if precursor is not None:
2071 2084 metadata = {}
2072 2085 if 'date' in opts:
2073 2086 metadata['date'] = opts['date']
2074 2087 metadata['user'] = opts['user'] or ui.username()
2075 succs = tuple(bin(succ) for succ in successors)
2088 succs = tuple(parsenodeid(succ) for succ in successors)
2076 2089 l = repo.lock()
2077 2090 try:
2078 2091 tr = repo.transaction('debugobsolete')
2079 2092 try:
2080 repo.obsstore.create(tr, bin(precursor), succs, 0, metadata)
2093 repo.obsstore.create(tr, parsenodeid(precursor), succs, 0,
2094 metadata)
2081 2095 tr.close()
2082 2096 finally:
2083 2097 tr.release()
@@ -31,6 +31,12 b''
31 31 Killing a single changeset without replacement
32 32
33 33 $ mkcommit kill_me
34 $ hg debugobsolete 0
35 abort: changeset references must be full hexadecimal node identifiers
36 [255]
37 $ hg debugobsolete '00'
38 abort: changeset references must be full hexadecimal node identifiers
39 [255]
34 40 $ hg debugobsolete -d '0 0' `getid kill_me` -u babar
35 41 $ hg debugobsolete
36 42 97b7c2d76b1845ed3eb988cd612611e72406cef0 0 {'date': '0 0', 'user': 'babar'}
General Comments 0
You need to be logged in to leave comments. Login now