I'm not going to say it's a bad idea, but I've never even thought about it. I don't think I've ever even had the opportunity to go up a tree before shooting at a hog. At least half or more of mine have shot in open pastures, and the rest I've stalked until I got close enough to make a shot. Climbing a tree would certainly create too much commotion and scare the hogs away. Now, if you're setting up an ambush at a water hole or feeder, maybe it's a consideration. However, in my (limited) experience once I shoot, the hogs take off like greased pinballs on fire in whatever direction they think safety lies. So far I haven't been in their direct path. If I were, I think another shot would convince them that their safest path lay elsewhere.
I almost always carry a pistol with me (to finish off a wounded hog) but I doubt that I could get it out fast enough to defend myself should the need arise. With a single-shot weapon, maybe just make sure you know where the nearest tree is so you can jump behind it.