# HG changeset patch # User Scott Chacon # Date 1242060386 25200 # Node ID dca3be87e9f167dacb4d9713516cd47768edd359 # Parent c00bee6c5de7d5ad6cd3132dff6f5c163ac2945d i cannot for the heck of me figure out why renames are handled this way, but so be it, it works diff --git a/TODO.txt b/TODO.txt --- a/TODO.txt +++ b/TODO.txt @@ -22,10 +22,6 @@ MAPPING ISSUES ============== -Created in Hg: -* merges with renames in 2nd branch - - dont convert back properly for some reason - Created in Git: * encoding field / utf-8 * octopus merge explode/implode diff --git a/git_handler.py b/git_handler.py --- a/git_handler.py +++ b/git_handler.py @@ -434,7 +434,8 @@ todo = [] done = set() convert_list = {} - + self.renames = {} + # get a list of all the head shas for head, sha in self.git.remote_refs(remote_name).iteritems(): todo.append(sha) @@ -543,14 +544,12 @@ # get a list of the changed, added, removed files files = self.git.get_files_changed(commit) - # if this is a merge commit, don't list renamed files - # i'm really confused here - this is the only way my use case will - # work, but it seems really hacky - do I need to just remove renames - # from one of the parents? AARRGH! + # wierd hack for explicit file renames in first but not second branch if not (p2 == "0"*40): - for removefile in hg_renames.values(): + vals = [item for item in self.renames[p1].values() if not item in self.renames[p2].values()] + for removefile in vals: files.remove(removefile) - + extra = {} # if named branch, add to extra @@ -571,10 +570,19 @@ a = self.repo.commitctx(ctx) # get changeset id - p2 = hex(self.repo.changelog.tip()) + cs = hex(self.repo.changelog.tip()) # save changeset to mapping file gitsha = commit.id - self.map_set(gitsha, p2) + + # saving rename info + if (not (p2 == "0"*40) or (p1 == "0"*40)): + self.renames[cs] = {} + else: + self.renames[cs] = self.renames[p1].copy() + + self.renames[cs].update(hg_renames) + + self.map_set(gitsha, cs) def check_bookmarks(self): if self.ui.config('extensions', 'hgext.bookmarks') is not None: