Tuesday, June 16, 2015

Module Path in Python

Hello fellas,

Lost in your build? Too many env variables? No idea what calls which, and need to see the implementation in a specific module, at god knows where?

>> import <module_name>         
>> print <module_name>.__file__ 

is what you need: the abs path of the module. Cheers!

Friday, June 5, 2015

Perforce: Back-out From an Existing Change

Using super-duper Perforce system for "helix" versioning , but you still make mistakes and need to back out a changelist? And you need to do it from command line, since you are not a GUI person and not good with p4's beautiful "back out" and "rollback" buttons"? Here is how:

> p4 sync <filename>@<the last changelist number before your change>
> p4 edit <filename>
> p4 sync <filename>@<your changelist number>
> p4 resolve -ay
> p4 sync <filename>
> p4 resolve
> p4 submit <filename>

Notes:
  •  If you don't know the filename, check the beginning of "p4 descibe <your changelist number> | less".
  •  If you don't know your changelist number, check "p4 changes | grep <your username>".