equal
deleted
inserted
replaced
2752 fm.data(path=path) |
2752 fm.data(path=path) |
2753 |
2753 |
2754 |
2754 |
2755 def cat(ui, repo, ctx, matcher, basefm, fntemplate, prefix, **opts): |
2755 def cat(ui, repo, ctx, matcher, basefm, fntemplate, prefix, **opts): |
2756 err = 1 |
2756 err = 1 |
2757 opts = pycompat.byteskwargs(opts) |
|
2758 |
2757 |
2759 def write(path): |
2758 def write(path): |
2760 filename = None |
2759 filename = None |
2761 if fntemplate: |
2760 if fntemplate: |
2762 filename = makefilename( |
2761 filename = makefilename( |
2766 try: |
2765 try: |
2767 os.makedirs(os.path.dirname(filename)) |
2766 os.makedirs(os.path.dirname(filename)) |
2768 except OSError: |
2767 except OSError: |
2769 pass |
2768 pass |
2770 with formatter.maybereopen(basefm, filename) as fm: |
2769 with formatter.maybereopen(basefm, filename) as fm: |
2771 _updatecatformatter(fm, ctx, matcher, path, opts.get(b'decode')) |
2770 _updatecatformatter(fm, ctx, matcher, path, opts.get('decode')) |
2772 |
2771 |
2773 # Automation often uses hg cat on single files, so special case it |
2772 # Automation often uses hg cat on single files, so special case it |
2774 # for performance to avoid the cost of parsing the manifest. |
2773 # for performance to avoid the cost of parsing the manifest. |
2775 if len(matcher.files()) == 1 and not matcher.anypats(): |
2774 if len(matcher.files()) == 1 and not matcher.anypats(): |
2776 file = matcher.files()[0] |
2775 file = matcher.files()[0] |
2801 if not sub.cat( |
2800 if not sub.cat( |
2802 submatch, |
2801 submatch, |
2803 basefm, |
2802 basefm, |
2804 fntemplate, |
2803 fntemplate, |
2805 subprefix, |
2804 subprefix, |
2806 **pycompat.strkwargs(opts), |
2805 **opts, |
2807 ): |
2806 ): |
2808 err = 0 |
2807 err = 0 |
2809 except error.RepoLookupError: |
2808 except error.RepoLookupError: |
2810 ui.status( |
2809 ui.status( |
2811 _(b"skipping missing subrepository: %s\n") % uipathfn(subpath) |
2810 _(b"skipping missing subrepository: %s\n") % uipathfn(subpath) |