Mercurial > hgsubversion
annotate hgsubversion/util.py @ 410:eb524b957345
move aresamefiles() from HgChangeReceiver to util
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Wed, 10 Jun 2009 17:29:11 +0200 |
parents | f137231f9d30 |
children | cd6317fe70be |
rev | line source |
---|---|
0
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
1 import os |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
2 import shutil |
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
3 |
196
77812f98e250
Add a naive hg svn version command that works as long as hgsubversion is run from a checkout.
Augie Fackler <durin42@gmail.com>
parents:
195
diff
changeset
|
4 from mercurial import hg |
34
50d55c3e0d85
Some refactors of the previous change, including transparent upgrade of old-style pickled dictionaries.
Augie Fackler <durin42@gmail.com>
parents:
19
diff
changeset
|
5 from mercurial import node |
250
79349fd04836
utils: standardizing imported name to hgutil, our_util to util
Daniel Tang <dytang@cs.purdue.edu>
parents:
249
diff
changeset
|
6 from mercurial import util as hgutil |
34
50d55c3e0d85
Some refactors of the previous change, including transparent upgrade of old-style pickled dictionaries.
Augie Fackler <durin42@gmail.com>
parents:
19
diff
changeset
|
7 |
196
77812f98e250
Add a naive hg svn version command that works as long as hgsubversion is run from a checkout.
Augie Fackler <durin42@gmail.com>
parents:
195
diff
changeset
|
8 |
265
9f0738587f94
Re-re-refix username support, add a comment so maybe I remember this time.
Augie Fackler <durin42@gmail.com>
parents:
263
diff
changeset
|
9 def getuserpass(opts): |
9f0738587f94
Re-re-refix username support, add a comment so maybe I remember this time.
Augie Fackler <durin42@gmail.com>
parents:
263
diff
changeset
|
10 # DO NOT default the user to hg's getuser(). If you provide |
9f0738587f94
Re-re-refix username support, add a comment so maybe I remember this time.
Augie Fackler <durin42@gmail.com>
parents:
263
diff
changeset
|
11 # *any* default username to Subversion, it won't use any remembered |
9f0738587f94
Re-re-refix username support, add a comment so maybe I remember this time.
Augie Fackler <durin42@gmail.com>
parents:
263
diff
changeset
|
12 # username for the desired realm, breaking OS X Keychain support, |
9f0738587f94
Re-re-refix username support, add a comment so maybe I remember this time.
Augie Fackler <durin42@gmail.com>
parents:
263
diff
changeset
|
13 # GNOME keyring support, and all similar tools. |
9f0738587f94
Re-re-refix username support, add a comment so maybe I remember this time.
Augie Fackler <durin42@gmail.com>
parents:
263
diff
changeset
|
14 return opts.get('username', None), opts.get('password', '') |
9f0738587f94
Re-re-refix username support, add a comment so maybe I remember this time.
Augie Fackler <durin42@gmail.com>
parents:
263
diff
changeset
|
15 |
9f0738587f94
Re-re-refix username support, add a comment so maybe I remember this time.
Augie Fackler <durin42@gmail.com>
parents:
263
diff
changeset
|
16 |
196
77812f98e250
Add a naive hg svn version command that works as long as hgsubversion is run from a checkout.
Augie Fackler <durin42@gmail.com>
parents:
195
diff
changeset
|
17 def version(ui): |
77812f98e250
Add a naive hg svn version command that works as long as hgsubversion is run from a checkout.
Augie Fackler <durin42@gmail.com>
parents:
195
diff
changeset
|
18 """Guess the version of hgsubversion. |
77812f98e250
Add a naive hg svn version command that works as long as hgsubversion is run from a checkout.
Augie Fackler <durin42@gmail.com>
parents:
195
diff
changeset
|
19 """ |
77812f98e250
Add a naive hg svn version command that works as long as hgsubversion is run from a checkout.
Augie Fackler <durin42@gmail.com>
parents:
195
diff
changeset
|
20 # TODO make this say something other than "unknown" for installed hgsubversion |
385
60b84e2d3336
version: fix version calculation for new repo layout.
Augie Fackler <durin42@gmail.com>
parents:
346
diff
changeset
|
21 dn = os.path.dirname |
60b84e2d3336
version: fix version calculation for new repo layout.
Augie Fackler <durin42@gmail.com>
parents:
346
diff
changeset
|
22 repo = hg.repository(ui, dn(dn(__file__))) |
196
77812f98e250
Add a naive hg svn version command that works as long as hgsubversion is run from a checkout.
Augie Fackler <durin42@gmail.com>
parents:
195
diff
changeset
|
23 ver = repo.dirstate.parents()[0] |
77812f98e250
Add a naive hg svn version command that works as long as hgsubversion is run from a checkout.
Augie Fackler <durin42@gmail.com>
parents:
195
diff
changeset
|
24 return node.hex(ver)[:12] |
77812f98e250
Add a naive hg svn version command that works as long as hgsubversion is run from a checkout.
Augie Fackler <durin42@gmail.com>
parents:
195
diff
changeset
|
25 |
0
f2636cfed115
Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
26 |
256
7932d098cb5f
Refactor commands to wrap their hg equivalent adding a --svn flag where sane.
Augie Fackler <durin42@gmail.com>
parents:
253
diff
changeset
|
27 def normalize_url(svnurl): |
284
f8f9a2993705
Implement parseurl support (#revision in repository urls)
Martijn Pieters <mj@zopatista.com>
parents:
281
diff
changeset
|
28 url, revs, checkout = hg.parseurl(svnurl) |
f8f9a2993705
Implement parseurl support (#revision in repository urls)
Martijn Pieters <mj@zopatista.com>
parents:
281
diff
changeset
|
29 url = url.rstrip('/') |
f8f9a2993705
Implement parseurl support (#revision in repository urls)
Martijn Pieters <mj@zopatista.com>
parents:
281
diff
changeset
|
30 if checkout: |
f8f9a2993705
Implement parseurl support (#revision in repository urls)
Martijn Pieters <mj@zopatista.com>
parents:
281
diff
changeset
|
31 url = '%s#%s' % (url, checkout) |
f8f9a2993705
Implement parseurl support (#revision in repository urls)
Martijn Pieters <mj@zopatista.com>
parents:
281
diff
changeset
|
32 return url |
140
9ffde8662967
util: Add a command to normalize svn urls and use it in a couple of places. Test that it works and prevents failed assertions.
Augie Fackler <durin42@gmail.com>
parents:
124
diff
changeset
|
33 |
9ffde8662967
util: Add a command to normalize svn urls and use it in a couple of places. Test that it works and prevents failed assertions.
Augie Fackler <durin42@gmail.com>
parents:
124
diff
changeset
|
34 |
39
b3c7b844b782
Some more fixes of cases discovered in the melange repo. If anyone knows how I can reproduce a "replaced" state in Subversion, I'd love to be able to make a real test case for this code.
Augie Fackler <durin42@gmail.com>
parents:
34
diff
changeset
|
35 class PrefixMatch(object): |
b3c7b844b782
Some more fixes of cases discovered in the melange repo. If anyone knows how I can reproduce a "replaced" state in Subversion, I'd love to be able to make a real test case for this code.
Augie Fackler <durin42@gmail.com>
parents:
34
diff
changeset
|
36 def __init__(self, prefix): |
b3c7b844b782
Some more fixes of cases discovered in the melange repo. If anyone knows how I can reproduce a "replaced" state in Subversion, I'd love to be able to make a real test case for this code.
Augie Fackler <durin42@gmail.com>
parents:
34
diff
changeset
|
37 self.p = prefix |
140
9ffde8662967
util: Add a command to normalize svn urls and use it in a couple of places. Test that it works and prevents failed assertions.
Augie Fackler <durin42@gmail.com>
parents:
124
diff
changeset
|
38 |
39
b3c7b844b782
Some more fixes of cases discovered in the melange repo. If anyone knows how I can reproduce a "replaced" state in Subversion, I'd love to be able to make a real test case for this code.
Augie Fackler <durin42@gmail.com>
parents:
34
diff
changeset
|
39 def files(self): |
b3c7b844b782
Some more fixes of cases discovered in the melange repo. If anyone knows how I can reproduce a "replaced" state in Subversion, I'd love to be able to make a real test case for this code.
Augie Fackler <durin42@gmail.com>
parents:
34
diff
changeset
|
40 return [] |
140
9ffde8662967
util: Add a command to normalize svn urls and use it in a couple of places. Test that it works and prevents failed assertions.
Augie Fackler <durin42@gmail.com>
parents:
124
diff
changeset
|
41 |
39
b3c7b844b782
Some more fixes of cases discovered in the melange repo. If anyone knows how I can reproduce a "replaced" state in Subversion, I'd love to be able to make a real test case for this code.
Augie Fackler <durin42@gmail.com>
parents:
34
diff
changeset
|
42 def __call__(self, fn): |
b3c7b844b782
Some more fixes of cases discovered in the melange repo. If anyone knows how I can reproduce a "replaced" state in Subversion, I'd love to be able to make a real test case for this code.
Augie Fackler <durin42@gmail.com>
parents:
34
diff
changeset
|
43 return fn.startswith(self.p) |
99
1da7aafdd323
Refactored outgoing_revisions into util where it really belongs.
Augie Fackler <durin42@gmail.com>
parents:
39
diff
changeset
|
44 |
152
1fde85a10f9e
push: Fix the bad implementation that required modifying the dirstate to push.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
45 def outgoing_revisions(ui, repo, hg_editor, reverse_map, sourcerev): |
99
1da7aafdd323
Refactored outgoing_revisions into util where it really belongs.
Augie Fackler <durin42@gmail.com>
parents:
39
diff
changeset
|
46 """Given a repo and an hg_editor, determines outgoing revisions for the |
1da7aafdd323
Refactored outgoing_revisions into util where it really belongs.
Augie Fackler <durin42@gmail.com>
parents:
39
diff
changeset
|
47 current working copy state. |
1da7aafdd323
Refactored outgoing_revisions into util where it really belongs.
Augie Fackler <durin42@gmail.com>
parents:
39
diff
changeset
|
48 """ |
1da7aafdd323
Refactored outgoing_revisions into util where it really belongs.
Augie Fackler <durin42@gmail.com>
parents:
39
diff
changeset
|
49 outgoing_rev_hashes = [] |
152
1fde85a10f9e
push: Fix the bad implementation that required modifying the dirstate to push.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
50 if sourcerev in reverse_map: |
99
1da7aafdd323
Refactored outgoing_revisions into util where it really belongs.
Augie Fackler <durin42@gmail.com>
parents:
39
diff
changeset
|
51 return |
152
1fde85a10f9e
push: Fix the bad implementation that required modifying the dirstate to push.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
52 sourcerev = repo[sourcerev] |
1fde85a10f9e
push: Fix the bad implementation that required modifying the dirstate to push.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
53 while (not sourcerev.node() in reverse_map |
1fde85a10f9e
push: Fix the bad implementation that required modifying the dirstate to push.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
54 and sourcerev.node() != node.nullid): |
1fde85a10f9e
push: Fix the bad implementation that required modifying the dirstate to push.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
55 outgoing_rev_hashes.append(sourcerev.node()) |
1fde85a10f9e
push: Fix the bad implementation that required modifying the dirstate to push.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
56 sourcerev = sourcerev.parents() |
221
ced45b753ba7
util: better error messages when finding svn parent of a revision.
Augie Fackler <durin42@gmail.com>
parents:
198
diff
changeset
|
57 if len(sourcerev) != 1: |
250
79349fd04836
utils: standardizing imported name to hgutil, our_util to util
Daniel Tang <dytang@cs.purdue.edu>
parents:
249
diff
changeset
|
58 raise hgutil.Abort("Sorry, can't find svn parent of a merge revision.") |
152
1fde85a10f9e
push: Fix the bad implementation that required modifying the dirstate to push.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
59 sourcerev = sourcerev[0] |
1fde85a10f9e
push: Fix the bad implementation that required modifying the dirstate to push.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
60 if sourcerev.node() != node.nullid: |
99
1da7aafdd323
Refactored outgoing_revisions into util where it really belongs.
Augie Fackler <durin42@gmail.com>
parents:
39
diff
changeset
|
61 return outgoing_rev_hashes |
124
291925677a9f
tag_repo: remove gentags command, extend repo.tags(), HgChangeEditor now takes either repo or repo_path
Luke Opperman <luke@loppear.com>
parents:
115
diff
changeset
|
62 |
154
6fa97cfbf62f
fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents:
152
diff
changeset
|
63 def build_extra(revnum, branch, uuid, subdir): |
6fa97cfbf62f
fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents:
152
diff
changeset
|
64 extra = {} |
6fa97cfbf62f
fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents:
152
diff
changeset
|
65 branchpath = 'trunk' |
6fa97cfbf62f
fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents:
152
diff
changeset
|
66 if branch: |
6fa97cfbf62f
fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents:
152
diff
changeset
|
67 extra['branch'] = branch |
6fa97cfbf62f
fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents:
152
diff
changeset
|
68 branchpath = 'branches/%s' % branch |
6fa97cfbf62f
fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents:
152
diff
changeset
|
69 if subdir and subdir[-1] == '/': |
6fa97cfbf62f
fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents:
152
diff
changeset
|
70 subdir = subdir[:-1] |
6fa97cfbf62f
fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents:
152
diff
changeset
|
71 if subdir and subdir[0] != '/': |
6fa97cfbf62f
fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents:
152
diff
changeset
|
72 subdir = '/' + subdir |
6fa97cfbf62f
fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents:
152
diff
changeset
|
73 extra['convert_revision'] = 'svn:%(uuid)s%(path)s@%(rev)s' % { |
6fa97cfbf62f
fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents:
152
diff
changeset
|
74 'uuid': uuid, |
6fa97cfbf62f
fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents:
152
diff
changeset
|
75 'path': '%s/%s' % (subdir , branchpath), |
6fa97cfbf62f
fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents:
152
diff
changeset
|
76 'rev': revnum, |
6fa97cfbf62f
fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents:
152
diff
changeset
|
77 } |
6fa97cfbf62f
fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents:
152
diff
changeset
|
78 return extra |
6fa97cfbf62f
fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents:
152
diff
changeset
|
79 |
124
291925677a9f
tag_repo: remove gentags command, extend repo.tags(), HgChangeEditor now takes either repo or repo_path
Luke Opperman <luke@loppear.com>
parents:
115
diff
changeset
|
80 |
291925677a9f
tag_repo: remove gentags command, extend repo.tags(), HgChangeEditor now takes either repo or repo_path
Luke Opperman <luke@loppear.com>
parents:
115
diff
changeset
|
81 def is_svn_repo(repo): |
346
4b992ebdecc6
improve reliability of Subversion checks.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
342
diff
changeset
|
82 return os.path.exists(os.path.join(repo.path, 'svn', 'uuid')) |
186
6266ba36ee15
Create patch to make normal output much less verbose…
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
185
diff
changeset
|
83 |
6266ba36ee15
Create patch to make normal output much less verbose…
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
185
diff
changeset
|
84 default_commit_msg = '*** empty log message ***' |
6266ba36ee15
Create patch to make normal output much less verbose…
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
185
diff
changeset
|
85 |
198
df4611050286
Output consolidation; decrease the ‘Fetching...’ message to debug level.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
196
diff
changeset
|
86 def describe_revision(ui, r): |
186
6266ba36ee15
Create patch to make normal output much less verbose…
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
185
diff
changeset
|
87 try: |
6266ba36ee15
Create patch to make normal output much less verbose…
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
185
diff
changeset
|
88 msg = [s for s in map(str.strip, r.message.splitlines()) if s][0] |
6266ba36ee15
Create patch to make normal output much less verbose…
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
185
diff
changeset
|
89 except: |
6266ba36ee15
Create patch to make normal output much less verbose…
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
185
diff
changeset
|
90 msg = default_commit_msg |
6266ba36ee15
Create patch to make normal output much less verbose…
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
185
diff
changeset
|
91 |
198
df4611050286
Output consolidation; decrease the ‘Fetching...’ message to debug level.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
196
diff
changeset
|
92 ui.status(('[r%d] %s: %s' % (r.revnum, r.author, msg))[:80] + '\n') |
186
6266ba36ee15
Create patch to make normal output much less verbose…
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
185
diff
changeset
|
93 |
198
df4611050286
Output consolidation; decrease the ‘Fetching...’ message to debug level.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
196
diff
changeset
|
94 def describe_commit(ui, h, b): |
df4611050286
Output consolidation; decrease the ‘Fetching...’ message to debug level.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
196
diff
changeset
|
95 ui.note(' committed to "%s" as %s\n' % ((b or 'default'), node.short(h))) |
223
330f0b15d417
issue67: mercurial 1.3 util incompatibility with encoding swap
Luke Opperman <luke@loppear.com>
parents:
221
diff
changeset
|
96 |
330f0b15d417
issue67: mercurial 1.3 util incompatibility with encoding swap
Luke Opperman <luke@loppear.com>
parents:
221
diff
changeset
|
97 |
330f0b15d417
issue67: mercurial 1.3 util incompatibility with encoding swap
Luke Opperman <luke@loppear.com>
parents:
221
diff
changeset
|
98 def swap_out_encoding(new_encoding="UTF-8"): |
281
8ff0b3261b7f
util: drop 1.2 support in the encoding swap.
Augie Fackler <durin42@gmail.com>
parents:
275
diff
changeset
|
99 """ Utility for mercurial incompatibility changes, can be removed after 1.3 |
8ff0b3261b7f
util: drop 1.2 support in the encoding swap.
Augie Fackler <durin42@gmail.com>
parents:
275
diff
changeset
|
100 """ |
8ff0b3261b7f
util: drop 1.2 support in the encoding swap.
Augie Fackler <durin42@gmail.com>
parents:
275
diff
changeset
|
101 from mercurial import encoding |
8ff0b3261b7f
util: drop 1.2 support in the encoding swap.
Augie Fackler <durin42@gmail.com>
parents:
275
diff
changeset
|
102 old = encoding.encoding |
8ff0b3261b7f
util: drop 1.2 support in the encoding swap.
Augie Fackler <durin42@gmail.com>
parents:
275
diff
changeset
|
103 encoding.encoding = new_encoding |
223
330f0b15d417
issue67: mercurial 1.3 util incompatibility with encoding swap
Luke Opperman <luke@loppear.com>
parents:
221
diff
changeset
|
104 return old |
410
eb524b957345
move aresamefiles() from HgChangeReceiver to util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
408
diff
changeset
|
105 |
eb524b957345
move aresamefiles() from HgChangeReceiver to util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
408
diff
changeset
|
106 |
eb524b957345
move aresamefiles() from HgChangeReceiver to util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
408
diff
changeset
|
107 def aresamefiles(parentctx, childctx, files): |
eb524b957345
move aresamefiles() from HgChangeReceiver to util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
408
diff
changeset
|
108 """Assuming all files exist in childctx and parentctx, return True |
eb524b957345
move aresamefiles() from HgChangeReceiver to util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
408
diff
changeset
|
109 if none of them was changed in-between. |
eb524b957345
move aresamefiles() from HgChangeReceiver to util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
408
diff
changeset
|
110 """ |
eb524b957345
move aresamefiles() from HgChangeReceiver to util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
408
diff
changeset
|
111 if parentctx == childctx: |
eb524b957345
move aresamefiles() from HgChangeReceiver to util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
408
diff
changeset
|
112 return True |
eb524b957345
move aresamefiles() from HgChangeReceiver to util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
408
diff
changeset
|
113 if parentctx.rev() > childctx.rev(): |
eb524b957345
move aresamefiles() from HgChangeReceiver to util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
408
diff
changeset
|
114 parentctx, childctx = childctx, parentctx |
eb524b957345
move aresamefiles() from HgChangeReceiver to util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
408
diff
changeset
|
115 |
eb524b957345
move aresamefiles() from HgChangeReceiver to util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
408
diff
changeset
|
116 def selfandancestors(selfctx): |
eb524b957345
move aresamefiles() from HgChangeReceiver to util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
408
diff
changeset
|
117 yield selfctx |
eb524b957345
move aresamefiles() from HgChangeReceiver to util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
408
diff
changeset
|
118 for ctx in selfctx.ancestors(): |
eb524b957345
move aresamefiles() from HgChangeReceiver to util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
408
diff
changeset
|
119 yield ctx |
eb524b957345
move aresamefiles() from HgChangeReceiver to util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
408
diff
changeset
|
120 |
eb524b957345
move aresamefiles() from HgChangeReceiver to util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
408
diff
changeset
|
121 files = dict.fromkeys(files) |
eb524b957345
move aresamefiles() from HgChangeReceiver to util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
408
diff
changeset
|
122 for pctx in selfandancestors(childctx): |
eb524b957345
move aresamefiles() from HgChangeReceiver to util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
408
diff
changeset
|
123 if pctx.rev() <= parentctx.rev(): |
eb524b957345
move aresamefiles() from HgChangeReceiver to util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
408
diff
changeset
|
124 return True |
eb524b957345
move aresamefiles() from HgChangeReceiver to util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
408
diff
changeset
|
125 for f in pctx.files(): |
eb524b957345
move aresamefiles() from HgChangeReceiver to util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
408
diff
changeset
|
126 if f in files: |
eb524b957345
move aresamefiles() from HgChangeReceiver to util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
408
diff
changeset
|
127 return False |
eb524b957345
move aresamefiles() from HgChangeReceiver to util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
408
diff
changeset
|
128 # parentctx is not an ancestor of childctx, files are unrelated |
eb524b957345
move aresamefiles() from HgChangeReceiver to util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
408
diff
changeset
|
129 return False |