bzr send should write to a remote file when --output file provided

Bug #221021 reported by James on 2008-04-23
2
Affects Status Importance Assigned to Milestone
Bazaar
Low
Unassigned

Bug Description

Hi

When providing a merge directive/patch using bzr send, it would be nice if the --output / -o file could be a remote file. This way I can upload the merge directives to the remote server in one command.

e.g, assume the cwd is a local branch taken from remote.server

bzr send -o my.patch sftp://<email address hidden>/home/me/project/dev/foo

provides the my.patch file in the working directory. I then have to scp my.patch to remote.server separately to the send command.

but

bzr send -o sftp://<email address hidden>/home/me/project/directives/my.patch sftp://<email address hidden>/home/me/project/branches/dev/foo

fails with an error stating something similar to the file "sftp://<email address hidden>/home/me/project/directives/my.patch" could not be created. It should be easy to create a remote file plus it would streamline the provision of patches if the manual scp step could be removed.

I'm using the latest bzr 1.3 ubuntu package.

Thanks!

Aaron Bentley (abentley) wrote :

Surely you can pipe "bzr send -o-" to something that *does* create remote files?

James (james-ellis-gmail) wrote :

Aaron,

Your comment certainly outlines a possibility, in fact after some digging around this works:

bzr send -o - sftp://<email address hidden>/home/me/project/dev/foo | ssh <email address hidden> "cat > /home/me/project/directives/my.patch"

Note that scp doesn't take stdin as the input file (e.g via /dev/stdin)

This, though, strikes me as inefficient, plus I doubt it would actually even work on a windows system, and bzr purports to be cross platform. I don't use Windows but it's an issue worth considering.

Given that bazaar can branch from and push to anywhere supported (sftp, file, ftp, http etc etc), the output file should be able to be anywhere supported as well, provided I have write permissions. This would be more efficient, avoiding pipes etc etc:

bzr send -o sftp://<email address hidden>/home/me/project/directives/my.patch sftp://<email address hidden>/home/me/project/branches/dev/foo

Thanks!

PS: "-o -" is not documented - maybe that could be pushed into the next update ?

Martin Pool (mbp) wrote :

I agree that would be useful.

Changed in bzr:
importance: Undecided → Low
status: New → Confirmed
Martin Pool (mbp) wrote :

James, how about this new text for the manual:

Creating a merge directive
--------------------------

To create and optionally send a merge directive, use the ``send`` command.

By default, ``send`` will email the merge directive to the "submission
address" for the branch, which is typically the lead developer or the
development mailing list.
``send`` without options will create a merge directive, fire up your email
tool and attach it, ready for you to add the explanatory text bit.
(See the online help for ``send`` and
`Configuration Settings <../user-reference/bzr_man.html#configuration-settings>`_
in the User Reference for further details on how to configure this.)

Most projects like people to add some explanation to the mail along with
the patch, explaining the reason for the patch, and why it is done the way
it is. This gives a reviewer some context before going into the
line-by-line diff.

Alternatively, if the ``--output`` (or ``-o``) option is given, ``send``
will write the merge directive to a file, so you can mail it yourself,
examine it, or save it for later use. If an output file of ``-`` is
given, the directive is written to stdout. For example::

  cd X-fix-123
  bzr send -o ../fix-123.patch

James (james-ellis-gmail) wrote :

Hi Martin

That reads ok and I see the manual has already been updated with this in section 6.4.3

Adding it to the online help "bzr help send" would be good as well:

e.g:

-o ARG, --output=ARG Write directive to this file. If an output file of - is given, the directive is written to stdout

Thanks

Jelmer Vernooij (jelmer) on 2017-11-09
tags: added: check-for-breezy
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers