~ubuntu-branches/ubuntu/precise/mercurial/precise-updates

« back to all changes in this revision

Viewing changes to mercurial/cmdutil.py

  • Committer: Bazaar Package Importer
  • Author(s): Javi Merino
  • Date: 2011-03-06 16:01:58 UTC
  • mto: (28.1.2 sid) (1.1.14)
  • mto: This revision was merged to the branch mainline in revision 32.
  • Revision ID: james.westby@ubuntu.com-20110306160158-y94pzpmtd7b1xgjk
Tags: upstream-1.8
ImportĀ upstreamĀ versionĀ 1.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
147
147
        # attempt to parse old-style ranges first to deal with
148
148
        # things like old-tag which contain query metacharacters
149
149
        try:
 
150
            if isinstance(spec, int):
 
151
                seen.add(spec)
 
152
                l.append(spec)
 
153
                continue
 
154
 
150
155
            if revrangesep in spec:
151
156
                start, end = spec.split(revrangesep, 1)
152
157
                start = revfix(repo, start, 0)
228
233
    writable = 'w' in mode or 'a' in mode
229
234
 
230
235
    if not pat or pat == '-':
231
 
        return writable and sys.stdout or sys.stdin
 
236
        fp = writable and sys.stdout or sys.stdin
 
237
        return os.fdopen(os.dup(fp.fileno()), mode)
232
238
    if hasattr(pat, 'write') and writable:
233
239
        return pat
234
240
    if hasattr(pat, 'read') and 'r' in mode:
673
679
            parents.reverse()
674
680
        prev = (parents and parents[0]) or nullid
675
681
 
 
682
        shouldclose = False
676
683
        if not fp:
677
684
            fp = make_file(repo, template, node, total=total, seqno=seqno,
678
685
                           revwidth=revwidth, mode='ab')
 
686
            if fp != template:
 
687
                shouldclose = True
679
688
        if fp != sys.stdout and hasattr(fp, 'name'):
680
689
            repo.ui.note("%s\n" % fp.name)
681
690
 
694
703
        for chunk in patch.diff(repo, prev, node, opts=opts):
695
704
            fp.write(chunk)
696
705
 
 
706
        if shouldclose:
 
707
            fp.close()
 
708
 
697
709
    for seqno, rev in enumerate(revs):
698
710
        single(rev, seqno + 1, fp)
699
711
 
796
808
        branch = ctx.branch()
797
809
        # don't show the default branch name
798
810
        if branch != 'default':
799
 
            branch = encoding.tolocal(branch)
800
811
            self.ui.write(_("branch:      %s\n") % branch,
801
812
                          label='log.branch')
 
813
        for bookmark in self.repo.nodebookmarks(changenode):
 
814
            self.ui.write(_("bookmark:    %s\n") % bookmark,
 
815
                    label='log.bookmark')
802
816
        for tag in self.repo.nodetags(changenode):
803
817
            self.ui.write(_("tag:         %s\n") % tag,
804
818
                          label='log.tag')
1352
1366
    if ctx.p2():
1353
1367
        edittext.append(_("HG: branch merge"))
1354
1368
    if ctx.branch():
1355
 
        edittext.append(_("HG: branch '%s'")
1356
 
                        % encoding.tolocal(ctx.branch()))
 
1369
        edittext.append(_("HG: branch '%s'") % ctx.branch())
1357
1370
    edittext.extend([_("HG: subrepo %s") % s for s in subs])
1358
1371
    edittext.extend([_("HG: added %s") % f for f in added])
1359
1372
    edittext.extend([_("HG: changed %s") % f for f in modified])