Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.py @ 12176:ecab10820983
subrepos: add function for iterating over ctx subrepos
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Tue, 07 Sep 2010 16:34:07 +0200 |
parents | c0a8f9dea0f6 |
children | affec9fb56ef |
comparison
equal
deleted
inserted
replaced
12175:c0a8f9dea0f6 | 12176:ecab10820983 |
---|---|
8 from node import hex, bin, nullid, nullrev, short | 8 from node import hex, bin, nullid, nullrev, short |
9 from i18n import _ | 9 from i18n import _ |
10 import os, sys, errno, re, glob, tempfile | 10 import os, sys, errno, re, glob, tempfile |
11 import util, templater, patch, error, encoding, templatekw | 11 import util, templater, patch, error, encoding, templatekw |
12 import match as matchmod | 12 import match as matchmod |
13 import similar, revset | 13 import similar, revset, subrepo |
14 | 14 |
15 revrangesep = ':' | 15 revrangesep = ':' |
16 | 16 |
17 def parsealiases(cmd): | 17 def parsealiases(cmd): |
18 return cmd.lstrip("^").split("|") | 18 return cmd.lstrip("^").split("|") |
681 write(chunk, label=label) | 681 write(chunk, label=label) |
682 | 682 |
683 if listsubrepos: | 683 if listsubrepos: |
684 ctx1 = repo[node1] | 684 ctx1 = repo[node1] |
685 ctx2 = repo[node2] | 685 ctx2 = repo[node2] |
686 # Create a (subpath, ctx) mapping where we prefer subpaths | 686 for subpath, sub in subrepo.itersubrepos(ctx1, ctx2): |
687 # from ctx1. The subpaths from ctx2 are important when the | |
688 # .hgsub file has been modified (in ctx2) but not yet | |
689 # committed (in ctx1). | |
690 subpaths = dict.fromkeys(ctx2.substate, ctx2) | |
691 subpaths.update(dict.fromkeys(ctx1.substate, ctx1)) | |
692 for subpath, ctx in subpaths.iteritems(): | |
693 sub = ctx.sub(subpath) | |
694 if node2 is not None: | 687 if node2 is not None: |
695 node2 = bin(ctx2.substate[subpath][1]) | 688 node2 = bin(ctx2.substate[subpath][1]) |
696 submatch = matchmod.narrowmatcher(subpath, match) | 689 submatch = matchmod.narrowmatcher(subpath, match) |
697 sub.diff(diffopts, node2, submatch, changes=changes, | 690 sub.diff(diffopts, node2, submatch, changes=changes, |
698 stat=stat, fp=fp, prefix=prefix) | 691 stat=stat, fp=fp, prefix=prefix) |