Skip to contentSkip to conversation

Replace tab-indent with space-indent

PATCH In review Masaki Kanno 3 participants 3 messages Jul 2, 2008 – Jul 11, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Replace tab-indent with space-indent

Hi,

This patch replaces tab-indent with space-indent in the following Xend codes.
- tools/python/xen/xend/XendConfig.py
- tools/python/xen/xend/image.py
- tools/python/xen/xend/osdep.py

Best regards,
Kan

tools/python/xen/xend/XendConfig.py +1 -1
diff -r 19970181d6a4 tools/python/xen/xend/XendConfig.py
@@ -1762,7 +1762,7 @@
         return self['HVM_boot_policy'] != ''
 
     def target(self):
-	return self['target']
+        return self['target']
 
     def image_type(self):
         stored_type = self['platform'].get('image_type')
tools/python/xen/xend/image.py +1 -1
diff -r 19970181d6a4 tools/python/xen/xend/image.py
@@ -214,7 +214,7 @@
         method is called before any devices are set up."""
         
         domid = self.vm.getDomid()
-	
+        
         # Delete left-over pipes
         try:
             os.unlink('/var/run/tap/qemu-read-%d' % domid)
tools/python/xen/xend/osdep.py +5 -5
diff -r 19970181d6a4 tools/python/xen/xend/osdep.py
@@ -67,11 +67,11 @@
     BLN_IOCTL_LOW = 0x42410003
     BLN_IOCTL_HIGH = 0x42410004
     BLN_IOCTL_LIMIT = 0x42410005
-    label_to_ioctl = {	'Current allocation'	: BLN_IOCTL_CURRENT,
-			'Requested target'	: BLN_IOCTL_TARGET,
-			'Low-mem balloon'	: BLN_IOCTL_LOW,
-			'High-mem balloon'	: BLN_IOCTL_HIGH,
-			'Xen hard limit'	: BLN_IOCTL_LIMIT }
+    label_to_ioctl = { 'Current allocation' : BLN_IOCTL_CURRENT,
+                       'Requested target'   : BLN_IOCTL_TARGET,
+                       'Low-mem balloon'    : BLN_IOCTL_LOW,
+                       'High-mem balloon'   : BLN_IOCTL_HIGH,
+                       'Xen hard limit'     : BLN_IOCTL_LIMIT }
 
     f = file(DEV_XEN_BALLOON, 'r')
     try:

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

Masaki Kanno writes ("[Xen-devel] [PATCH] Replace tab-indent with space-indent"):

Quoted 5 lines

This patch replaces tab-indent with space-indent in the following Xend codes.
- tools/python/xen/xend/XendConfig.py
- tools/python/xen/xend/image.py
- tools/python/xen/xend/osdep.py

I don't think that patches like this should be committed. They have no benefit, but they do impose costs (such as hg annotate no longer giving accurate answers).

Ian.

#2 lore raw
Quoted 1 line · Ian Jackson

Masaki Kanno writes ("[Xen-devel] [PATCH] Replace tab-indent with

space-indent"):

Quoted 9 lines
Quoted 5 lines

This patch replaces tab-indent with space-indent in the following Xend codes.
- tools/python/xen/xend/XendConfig.py
- tools/python/xen/xend/image.py
- tools/python/xen/xend/osdep.py

I don't think that patches like this should be committed. They have no benefit, but they do impose costs (such as hg annotate no longer giving accurate answers).

If this weren't Python code or was a large change I might be dubious about it. However, since a classic source of Python bugs is the mixing of tabs and spaces, standardising on spaces (which is what we've always aimed to do) seems quite desirable - if for no other reason than to avoid future contributors making the same mistake.

That said, it's doubly important to thoroughly check any tab->space conversions since these can easily do something other than what's expected... Converting a lot of them would be a bit scary...

Kan, are these the only cases of tabs you found in Python code, or might there be more elsewhere? If these are the only few that remain, I'd suggest we eliminate them and then work to avoid introducing any more tabs in future (ideally, we'd push a check for these into a test suite that's run before the patch is accepted). That would bring us fully into conformance with our own coding style; the patch looks small enough to cause a minimal disruption to annotate.

If we have a wide tabs / spaces problem in the code then we might want to keep this patch on hold and figure out just how large the problem is - and therefore whether it's safer to standardise or leave it alone!

Cheers,
Mark

Signature · 1 line
Push Me Pull You - Distributed SCM tool (http://www.cl.cam.ac.uk/~maw48/pmpu/)