On Sat, Nov 05, 2022 at 03:39:26AM +0200, Nir Soffer wrote:
On Fri, Nov 4, 2022 at 11:18 PM Eric Blake <eblake@redhat.com> wrote: [...]
@@ -127,7 +129,10 @@ def __call__(self, parser, namespace, values, option_string=None): os.environ["LIBNBD_DEBUG"] = "1"
# Create the handle. - if not args.n: + if args.n: + pass + else:
Why add useless branch?
Yes this is a bit of a strange change. What was wrong with the original "if not ..."? Perl's "unless" statement FTW :-)
+ global h h = nbd.NBD() h.set_handle_name("nbdsh")
@@ -165,21 +170,35 @@ def line(x): lines.append(x) def blank(): line("") def example(ex, desc): line("%-34s # %s" % (ex, desc))
+ connect_hint = False + go_hint = False blank() line("Welcome to nbdsh, the shell for interacting with") line("Network Block Device (NBD) servers.") blank() - if not args.n: - line("The ‘nbd’ module has already been imported and there") - line("is an open NBD handle called ‘h’.") - blank() - else: + if args.n: line("The ‘nbd’ module has already been imported.") blank() example("h = nbd.NBD()", "Create a new handle.") - if False: # args.uri is None:
Good that this was removed, but it will be better to remove in the previous patch.
I believe for intermediate patches this is OK, if it's resolved in the end. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org