Mercurial > hg
comparison hgext/convert/cvs.py @ 6077:fb259a3572e9
convert: try to be smarter about CVS branching
Better handles this case:
The output from cvsps -A -u --cvs-direct -q:
---------------------
PatchSet 1
Date: 2008/02/08 20:33:28
Author: fk
Branch: HEAD
Tag: (none)
Log:
initial
Members:
file_one:INITIAL->1.1
---------------------
PatchSet 2
Date: 2008/02/08 20:33:32
Author: fk
Branch: branch_name
Ancestor branch: HEAD
Tag: (none)
Log:
new file on branch
Members:
file_two:1.1->1.1.2.1
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 11 Feb 2008 16:16:05 -0600 |
parents | 549a7ebe1607 |
children | 308988071b90 |
comparison
equal
deleted
inserted
replaced
6076:0ee885fea464 | 6077:fb259a3572e9 |
---|---|
69 self.parent[id] = self.lastbranch.get(branch, 'bad') | 69 self.parent[id] = self.lastbranch.get(branch, 'bad') |
70 self.lastbranch[branch] = id | 70 self.lastbranch[branch] = id |
71 elif l.startswith("Ancestor branch"): | 71 elif l.startswith("Ancestor branch"): |
72 ancestor = l[17:-1] | 72 ancestor = l[17:-1] |
73 # figure out the parent later | 73 # figure out the parent later |
74 self.parent[id] = None | 74 self.parent[id] = self.lastbranch[ancestor] |
75 elif l.startswith("Author"): | 75 elif l.startswith("Author"): |
76 author = self.recode(l[8:-1]) | 76 author = self.recode(l[8:-1]) |
77 elif l.startswith("Tag:") or l.startswith("Tags:"): | 77 elif l.startswith("Tag:") or l.startswith("Tags:"): |
78 t = l[l.index(':')+1:] | 78 t = l[l.index(':')+1:] |
79 t = [ut.strip() for ut in t.split(',')] | 79 t = [ut.strip() for ut in t.split(',')] |
99 p = [self.parent[id]] | 99 p = [self.parent[id]] |
100 if id == "1": | 100 if id == "1": |
101 p = [] | 101 p = [] |
102 if branch == "HEAD": | 102 if branch == "HEAD": |
103 branch = "" | 103 branch = "" |
104 if branch and p[0] == None: | 104 if branch: |
105 latest = None | 105 latest = None |
106 # the last changeset that contains a base | 106 # the last changeset that contains a base |
107 # file is our parent | 107 # file is our parent |
108 for r in oldrevs: | 108 for r in oldrevs: |
109 latest = max(filerevids[r], latest) | 109 latest = max(filerevids.get(r, None), latest) |
110 p = [latest] | 110 if latest: |
111 p = [latest] | |
111 | 112 |
112 # add current commit to set | 113 # add current commit to set |
113 c = commit(author=author, date=date, parents=p, | 114 c = commit(author=author, date=date, parents=p, |
114 desc=log, branch=branch) | 115 desc=log, branch=branch) |
115 self.changeset[id] = c | 116 self.changeset[id] = c |