1 #!/usr/bin/env python |
1 #!/usr/bin/env python |
2 # |
2 # |
3 # mercurial - a minimal scalable distributed SCM |
3 # mercurial - a minimal scalable distributed SCM |
4 # v0.4d "oedipa maas" |
4 # v0.4e "sabina" |
5 # |
5 # |
6 # Copyright 2005 Matt Mackall <mpm@selenic.com> |
6 # Copyright 2005 Matt Mackall <mpm@selenic.com> |
7 # |
7 # |
8 # This software may be used and distributed according to the terms |
8 # This software may be used and distributed according to the terms |
9 # of the GNU General Public License, incorporated herein by reference. |
9 # of the GNU General Public License, incorporated herein by reference. |
145 |
145 |
146 for patch in args: |
146 for patch in args: |
147 ui.status("applying %s\n" % patch) |
147 ui.status("applying %s\n" % patch) |
148 pf = os.path.join(d, patch) |
148 pf = os.path.join(d, patch) |
149 |
149 |
150 text = "" |
150 text = "" |
151 for l in file(pf): |
151 for l in file(pf): |
152 if l[:3] == "---": break |
152 if l[:3] == "---": break |
153 text += l |
153 text += l |
154 |
154 |
155 if os.system("patch -p%d < %s %s" % (strip, pf, quiet)): |
155 if os.system("patch -p%d < %s %s" % (strip, pf, quiet)): |
156 raise "patch failed!" |
156 raise "patch failed!" |
157 f = os.popen("lsdiff --strip %d %s" % (strip, pf)) |
157 f = os.popen("lsdiff --strip %d %s" % (strip, pf)) |
158 files = filter(None, map(lambda x: x.rstrip(), f.read().splitlines())) |
158 files = filter(None, map(lambda x: x.rstrip(), f.read().splitlines())) |
159 f.close() |
159 f.close() |
186 prev = repo.changelog.parents(node)[0] |
186 prev = repo.changelog.parents(node)[0] |
187 diff(None, prev, node) |
187 diff(None, prev, node) |
188 |
188 |
189 elif cmd == "debugchangegroup": |
189 elif cmd == "debugchangegroup": |
190 newer = repo.newer(map(repo.changelog.lookup, args)) |
190 newer = repo.newer(map(repo.changelog.lookup, args)) |
191 cg = repo.changegroup(newer) |
191 for chunk in repo.changegroup(newer): |
192 sys.stdout.write(cg) |
192 sys.stdout.write(chunk) |
193 |
193 |
194 elif cmd == "debugaddchangegroup": |
194 elif cmd == "debugaddchangegroup": |
195 data = sys.stdin.read() |
195 data = sys.stdin.read() |
196 repo.addchangegroup(data) |
196 repo.addchangegroup(data) |
197 |
|
198 elif cmd == "debuggetchangegroup": |
|
199 if args: |
|
200 other = hg.repository(ui, args[0]) |
|
201 print "building changegroup" |
|
202 cg = repo.getchangegroup(other) |
|
203 print "applying changegroup" |
|
204 repo.addchangegroup(cg) |
|
205 else: |
|
206 print "missing source repository" |
|
207 |
197 |
208 elif cmd == "addremove": |
198 elif cmd == "addremove": |
209 (c, a, d) = repo.diffdir(repo.root, repo.current) |
199 (c, a, d) = repo.diffdir(repo.root, repo.current) |
210 repo.add(a) |
200 repo.add(a) |
211 repo.remove(d) |
201 repo.remove(d) |
281 hg.hex(e[4][:5]), hg.hex(e[5][:5]), hg.hex(e[6][:5])) |
271 hg.hex(e[4][:5]), hg.hex(e[5][:5]), hg.hex(e[6][:5])) |
282 |
272 |
283 elif cmd == "merge": |
273 elif cmd == "merge": |
284 if args: |
274 if args: |
285 other = hg.repository(ui, args[0]) |
275 other = hg.repository(ui, args[0]) |
|
276 print "retrieving changegroup" |
|
277 cg = repo.getchangegroup(other) |
|
278 repo.addchangegroup(cg) |
|
279 else: |
|
280 print "missing source repository" |
|
281 |
|
282 elif cmd == "debugoldmerge": |
|
283 if args: |
|
284 other = hg.repository(ui, args[0]) |
286 repo.merge(other) |
285 repo.merge(other) |
287 else: |
286 else: |
288 print "missing source repository" |
287 print "missing source repository" |
289 |
288 |
290 elif cmd == "verify": |
289 elif cmd == "verify": |