##// END OF EJS Templates
command: creation of obsolete marker...
Pierre-Yves.David@ens-lyon.org -
r17071:11f26e26 default
parent child Browse files
Show More
@@ -0,0 +1,49 b''
1
2 $ mkcommit() {
3 > echo "$1" > "$1"
4 > hg add "$1"
5 > hg ci -m "add $1"
6 > }
7 $ getid() {
8 > hg id --debug -ir "desc('$1')"
9 > }
10
11
12 $ hg init tmpa
13 $ cd tmpa
14
15 Killing a single changeset without replacement
16
17 $ mkcommit kill_me
18 $ hg debugobsolete -d '0 0' `getid kill_me` -u babar
19 $ cd ..
20
21 Killing a single changeset with replacement
22
23 $ hg init tmpb
24 $ cd tmpb
25 $ mkcommit a
26 $ mkcommit b
27 $ mkcommit original_c
28 $ hg up "desc('b')"
29 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
30 $ mkcommit new_c
31 created new head
32 $ hg debugobsolete `getid original_c` `getid new_c` -d '56 12'
33
34 do it again (it read the obsstore before adding new changeset)
35
36 $ hg up '.^'
37 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
38 $ mkcommit new_2_c
39 created new head
40 $ hg debugobsolete -d '1337 0' `getid new_c` `getid new_2_c`
41
42 Register two markers with a missing node
43
44 $ hg up '.^'
45 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
46 $ mkcommit new_3_c
47 created new head
48 $ hg debugobsolete -d '1338 0' `getid new_2_c` 1337133713371337133713371337133713371337
49 $ hg debugobsolete -d '1339 0' 1337133713371337133713371337133713371337 `getid new_3_c`
@@ -2049,6 +2049,21 b' def debugknown(ui, repopath, *ids, **opt'
2049 flags = repo.known([bin(s) for s in ids])
2049 flags = repo.known([bin(s) for s in ids])
2050 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
2050 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
2051
2051
2052 @command('debugobsolete', [] + commitopts2,
2053 _('OBSOLETED [REPLACEMENT] [REPL...'))
2054 def debugobsolete(ui, repo, precursor, *successors, **opts):
2055 """create arbitrary obsolete marker"""
2056 metadata = {}
2057 if 'date' in opts:
2058 metadata['date'] = opts['date']
2059 metadata['user'] = opts['user'] or ui.username()
2060 succs = tuple(bin(succ) for succ in successors)
2061 l = repo.lock()
2062 try:
2063 repo.obsstore.create(bin(precursor), succs, 0, metadata)
2064 finally:
2065 l.release()
2066
2052 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'))
2067 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'))
2053 def debugpushkey(ui, repopath, namespace, *keyinfo, **opts):
2068 def debugpushkey(ui, repopath, namespace, *keyinfo, **opts):
2054 '''access the pushkey key/value protocol
2069 '''access the pushkey key/value protocol
@@ -135,6 +135,23 b' class obsstore(object):'
135 self.precursors = {}
135 self.precursors = {}
136 self.successors = {}
136 self.successors = {}
137
137
138 def create(self, prec, succs=(), flag=0, metadata=None):
139 """obsolete: add a new obsolete marker
140
141 * ensuring it is hashable
142 * check mandatory metadata
143 * encode metadata
144 """
145 if metadata is None:
146 metadata = {}
147 if len(prec) != 20:
148 raise ValueError(prec)
149 for succ in succs:
150 if len(succ) != 20:
151 raise ValueError(prec)
152 marker = (str(prec), tuple(succs), int(flag), encodemeta(metadata))
153 self.add(marker)
154
138 def add(self, marker):
155 def add(self, marker):
139 """Add a new marker to the store
156 """Add a new marker to the store
140
157
@@ -86,6 +86,7 b' Show debug commands if there are no othe'
86 debugindexdot
86 debugindexdot
87 debuginstall
87 debuginstall
88 debugknown
88 debugknown
89 debugobsolete
89 debugpushkey
90 debugpushkey
90 debugpvec
91 debugpvec
91 debugrebuildstate
92 debugrebuildstate
@@ -236,6 +237,7 b' Show all commands + options'
236 debugindexdot:
237 debugindexdot:
237 debuginstall:
238 debuginstall:
238 debugknown:
239 debugknown:
240 debugobsolete: date, user
239 debugpushkey:
241 debugpushkey:
240 debugpvec:
242 debugpvec:
241 debugrebuildstate: rev
243 debugrebuildstate: rev
General Comments 0
You need to be logged in to leave comments. Login now